From c432dc9d5a753cf94dc30d720d30cfbdba61bc19 Mon Sep 17 00:00:00 2001 From: Laurent Date: Fri, 26 Apr 2024 12:14:40 +0200 Subject: [PATCH] Fix broadcast issue --- tournaments/models/tournament.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 393a3c6..90a29a9 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -37,10 +37,8 @@ class Tournament(models.Model): def __str__(self): if self.name: return self.name - elif self.event: - return self.event.display_name() else: - return '--' + return self.display_name() def display_name(self): if self.name: @@ -141,17 +139,16 @@ class Tournament(models.Model): def broadcast_content(self): - now = timezone.now() - - today_matches = [match for match in self.all_matches() if match.start_date] - today_matches = [match for match in today_matches if match.start_date.date() == now] - today_matches.sort(key=lambda m: m.start_date) + # now = timezone.now() + # matches_with_date = [match for match in self.all_matches() if match.start_date] + # today_matches = [match for match in today_matches if match.start_date.date() == now] + # matches_with_date.sort(key=lambda m: m.start_date) matches, group_stages = self.broadcasted_matches_and_group_stages() group_stages_dicts = [gs.to_dict() for gs in group_stages] # if now is before the first match, we want to show the summons + group stage or first matches - if today_matches and now < today_matches[0].start_date: + if timezone.now() < self.start_date: team_summons_dicts = [summon.to_dict() for summon in self.team_summons()] if group_stages: return {