From d9617ebad5605e0d190a189ddcab4480dfd49d7e Mon Sep 17 00:00:00 2001 From: Laurent Date: Sat, 9 Nov 2024 12:34:08 +0100 Subject: [PATCH 1/5] 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/5] 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/5] 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/5] 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/5] 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():