From 03e2b874e8c15bd8c36c2a44bd8034ebee1e4209 Mon Sep 17 00:00:00 2001 From: Raz Date: Wed, 16 Apr 2025 10:16:24 +0200 Subject: [PATCH] fix tz stuff and ttc stuff --- tournaments/models/tournament.py | 8 ++++++-- tournaments/signals.py | 6 +++--- tournaments/tasks.py | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index fa08156..d4f1a2d 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -1121,7 +1121,6 @@ class Tournament(BaseModel): return False # Get the current registration status status = self.get_online_registration_status() - print(status, self.has_started()) # Define which status values should allow automatic waiting list status_map = { OnlineRegistrationStatus.OPEN: True, @@ -1528,7 +1527,7 @@ class Tournament(BaseModel): datetime: The confirmation deadline datetime """ # Skip if feature not enabled - if self.enable_time_to_confirm is False: + if self.automatic_waiting_list() is False: return None config = settings.TOURNAMENT_SETTINGS['TIME_TO_CONFIRM'] @@ -1635,6 +1634,11 @@ class Tournament(BaseModel): ) print(f"Before hours: {before_hours}, After hours: {after_hours}") + tournament_start_date_minus_five = tournament_start_date - timedelta(minutes=5) + if raw_deadline >= tournament_start_date_minus_five: + print(f"Raw Deadline is after tournament_start_date_minus_five: {raw_deadline}, {tournament_start_date_minus_five}") + raw_deadline = tournament_start_date_minus_five + print(f"Live testing: {live_testing}") print(f"Current time: {current_time}") print(f"Minutes to confirm: {minutes_to_confirm}") diff --git a/tournaments/signals.py b/tournaments/signals.py index f3c42ec..4dad2f8 100644 --- a/tournaments/signals.py +++ b/tournaments/signals.py @@ -58,9 +58,9 @@ def notify_team(team, tournament, message_type): if tournament.has_ended(): print("returning because tournament.has_ended") return - # if tournament.will_start_soon(): - # print("returning because tournament.supposedly_in_progress") - # return + if tournament.has_started(): + print("returning because tournament.has_started") + return if is_not_sqlite_backend(): print("is_not_sqlite_backend") diff --git a/tournaments/tasks.py b/tournaments/tasks.py index d9b5f31..0b996ae 100644 --- a/tournaments/tasks.py +++ b/tournaments/tasks.py @@ -43,7 +43,7 @@ def check_confirmation_deadlines(): processed_teams.add(team_registration.id) tournament = team_registration.tournament - if not tournament or not tournament.automatic_waiting_list(): + if not tournament: continue teams = tournament.teams(True)