From d9617ebad5605e0d190a189ddcab4480dfd49d7e Mon Sep 17 00:00:00 2001 From: Laurent Date: Sat, 9 Nov 2024 12:34:08 +0100 Subject: [PATCH 1/8] tests if the team has a name to display the summons --- tournaments/models/team_registration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tournaments/models/team_registration.py b/tournaments/models/team_registration.py index 709c61f..3252031 100644 --- a/tournaments/models/team_registration.py +++ b/tournaments/models/team_registration.py @@ -87,7 +87,7 @@ class TeamRegistration(models.Model): return "--" def is_valid_for_summon(self): - return len(self.playerregistration_set.all()) > 0 + return len(self.playerregistration_set.all()) > 0 or self.name is not None def initial_weight(self): if self.locked_weight is None: From d2b65feaf857d59cdf3b6a3300956ee5188b3ea7 Mon Sep 17 00:00:00 2001 From: Laurent Date: Sat, 9 Nov 2024 12:39:32 +0100 Subject: [PATCH 2/8] remove prints --- tournaments/models/team_registration.py | 2 +- tournaments/models/tournament.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tournaments/models/team_registration.py b/tournaments/models/team_registration.py index 3252031..272163d 100644 --- a/tournaments/models/team_registration.py +++ b/tournaments/models/team_registration.py @@ -100,5 +100,5 @@ class TeamRegistration(models.Model): if self.call_date: return self.call_date.astimezone(timezone) else: - print("no date") + # print("no date") return None diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 36627ff..b8d9e2e 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -837,11 +837,11 @@ class Tournament(models.Model): start = timezoned_datetime.replace(hour=0, minute=0) - print(f"timezoned_datetime: {timezoned_datetime}") - print(f"tournament end date: {end}") - print(f"current time: {now}") - print(f"tournament start: {start}") - print(f"start <= now <= end: {start <= now <= end}") + # print(f"timezoned_datetime: {timezoned_datetime}") + # print(f"tournament end date: {end}") + # print(f"current time: {now}") + # print(f"tournament start: {start}") + # print(f"start <= now <= end: {start <= now <= end}") return start <= now <= end From 285ffcda3715545c94c4a872dade05c3bbbb665a Mon Sep 17 00:00:00 2001 From: Laurent Date: Sat, 9 Nov 2024 12:53:38 +0100 Subject: [PATCH 3/8] Fix crash --- tournaments/models/tournament.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index b8d9e2e..27e3b03 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -913,7 +913,7 @@ class TeamSummon: class TeamItem: def __init__(self, team_registration): - self.names = team_registration.team_names + self.names = team_registration.team_names() self.date = team_registration.local_call_date() self.weight = team_registration.weight self.initial_weight = team_registration.initial_weight() From df1bdb2cd27b4eca7a97eea5323167975667ab2b Mon Sep 17 00:00:00 2001 From: Laurent Date: Sat, 16 Nov 2024 19:22:06 +0100 Subject: [PATCH 4/8] attempt to fix date --- tournaments/models/tournament.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 27e3b03..55fb667 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -791,21 +791,22 @@ class Tournament(models.Model): if self.publish_brackets: return True + start_date = self.local_start_date() + first_match_start_date = self.first_match_start_date(bracket_matches) if first_match_start_date is None: - return timezone.now() >= self.start_date + return timezone.now() >= start_date bracket_start_date = self.getEightAm(first_match_start_date) - if bracket_start_date < self.start_date: - bracket_start_date = self.start_date + if bracket_start_date < start_date: + bracket_start_date = start_date group_stage_start_date = self.group_stage_start_date() if group_stage_start_date is not None: if bracket_start_date < group_stage_start_date: return False - if timezone.now() >= bracket_start_date: return True From 036a25430697fd4b3c237a2f01ac9673d8e452e2 Mon Sep 17 00:00:00 2001 From: Laurent Date: Sat, 16 Nov 2024 19:26:56 +0100 Subject: [PATCH 5/8] revert change --- tournaments/models/tournament.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 55fb667..5ee1c24 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -791,16 +791,14 @@ class Tournament(models.Model): if self.publish_brackets: return True - start_date = self.local_start_date() - first_match_start_date = self.first_match_start_date(bracket_matches) if first_match_start_date is None: - return timezone.now() >= start_date + return timezone.now() >= self.start_date bracket_start_date = self.getEightAm(first_match_start_date) - if bracket_start_date < start_date: - bracket_start_date = start_date + if bracket_start_date < self.start_date: + bracket_start_date = self.start_date group_stage_start_date = self.group_stage_start_date() if group_stage_start_date is not None: @@ -812,6 +810,7 @@ class Tournament(models.Model): return False + def bracket_matches(self): matches = [] for round in self.round_set.all(): From b2aece94a2e13c42216bf62bbb31f8b7fe7f8be4 Mon Sep 17 00:00:00 2001 From: Raz Date: Sat, 16 Nov 2024 19:44:41 +0100 Subject: [PATCH 6/8] fix matches display --- tournaments/models/tournament.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 36627ff..63f9d7f 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -803,7 +803,7 @@ class Tournament(models.Model): group_stage_start_date = self.group_stage_start_date() if group_stage_start_date is not None: if bracket_start_date < group_stage_start_date: - return False + return timezone.now() >=first_match_start_date if timezone.now() >= bracket_start_date: From 0d6be455e201d889657afa43902444b7a1555ed9 Mon Sep 17 00:00:00 2001 From: Raz Date: Mon, 18 Nov 2024 09:00:47 +0100 Subject: [PATCH 7/8] add single set of four games --- tournaments/models/enums.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tournaments/models/enums.py b/tournaments/models/enums.py index 02827a1..f3228d1 100644 --- a/tournaments/models/enums.py +++ b/tournaments/models/enums.py @@ -47,6 +47,8 @@ class FederalMatchCategory(models.IntegerChoices): TWO_SETS_OF_SUPER_TIE = 10, 'Two sets of Super Tie-Break decisive point' SINGLE_SET = 11, 'Single set' SINGLE_SET_DECISIVE_POINT = 12, 'Single set with decisive point' + SINGLE_SET_OF_FOUR_GAMES = 13, 'Single set of four games' + SINGLE_SET_OF_FOUR_GAMES_DECISIVE_POINT = 14, 'Single set of four games with decisive point' def last_set_is_tie_break(value): if value == FederalMatchCategory.TWO_SETS_FOUR_GAME or value == FederalMatchCategory.TWO_SETS_FOUR_GAME_DECISIVE_POINT or value == FederalMatchCategory.TWO_SETS_SUPER_TIE or value == FederalMatchCategory.SUPER_TIE or value == FederalMatchCategory.MEGA_TIE or value == FederalMatchCategory.TWO_SETS_DECISIVE_POINT_SUPER_TIE: @@ -55,7 +57,7 @@ class FederalMatchCategory(models.IntegerChoices): return False def max_number_of_sets(value): - if value == FederalMatchCategory.SUPER_TIE or value == FederalMatchCategory.MEGA_TIE or value == FederalMatchCategory.NINE_GAMES or value == FederalMatchCategory.NINE_GAMES_DECISIVE_POINT or value == FederalMatchCategory.SINGLE_SET or value == FederalMatchCategory.SINGLE_SET_DECISIVE_POINT: + if value == FederalMatchCategory.SUPER_TIE or value == FederalMatchCategory.MEGA_TIE or value == FederalMatchCategory.NINE_GAMES or value == FederalMatchCategory.NINE_GAMES_DECISIVE_POINT or value == FederalMatchCategory.SINGLE_SET or value == FederalMatchCategory.SINGLE_SET_DECISIVE_POINT or value == FederalMatchCategory.SINGLE_SET_OF_FOUR_GAMES or value == FederalMatchCategory.SINGLE_SET_OF_FOUR_GAMES_DECISIVE_POINT: return 1 else: return 3 From 18aa95f672a9df8dbb36f1ee37b099c270718cca Mon Sep 17 00:00:00 2001 From: Raz Date: Mon, 18 Nov 2024 09:02:40 +0100 Subject: [PATCH 8/8] add single set of four games --- ...racket_match_format_preference_and_more.py | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tournaments/migrations/0094_alter_customuser_bracket_match_format_preference_and_more.py diff --git a/tournaments/migrations/0094_alter_customuser_bracket_match_format_preference_and_more.py b/tournaments/migrations/0094_alter_customuser_bracket_match_format_preference_and_more.py new file mode 100644 index 0000000..f72d36f --- /dev/null +++ b/tournaments/migrations/0094_alter_customuser_bracket_match_format_preference_and_more.py @@ -0,0 +1,58 @@ +# Generated by Django 4.2.11 on 2024-11-18 08:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tournaments', '0093_drawlog_draw_type_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='customuser', + name='bracket_match_format_preference', + field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True), + ), + migrations.AlterField( + model_name='customuser', + name='group_stage_match_format_preference', + field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True), + ), + migrations.AlterField( + model_name='customuser', + name='loser_bracket_match_format_preference', + field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True), + ), + migrations.AlterField( + model_name='groupstage', + name='format', + field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True), + ), + migrations.AlterField( + model_name='match', + name='format', + field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True), + ), + migrations.AlterField( + model_name='round', + name='format', + field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True), + ), + migrations.AlterField( + model_name='tournament', + name='group_stage_format', + field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True), + ), + migrations.AlterField( + model_name='tournament', + name='loser_round_format', + field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True), + ), + migrations.AlterField( + model_name='tournament', + name='round_format', + field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True), + ), + ]