From 72352d06c193299de49bdfdcf23f1d495c4d0c16 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 10 Jun 2024 15:14:56 +0200 Subject: [PATCH] Fix crash --- tournaments/models/tournament.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 440fe6d..132dd64 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -378,7 +378,6 @@ class Tournament(models.Model): } def broadcasted_matches_and_group_stages(self): - matches = [] group_stages = [] @@ -388,14 +387,15 @@ class Tournament(models.Model): else: # last_started_match = self.first_unfinished_match() current_round = self.round_to_show() - previous_round = self.round_for_index(current_round.index + 1) + if current_round: + previous_round = self.round_for_index(current_round.index + 1) - if previous_round: - matches.extend(current_round.get_matches_recursive(True)) - matches.extend(previous_round.get_matches_recursive(True)) - else: - matches.extend(current_round.all_matches(True)) - group_stages = self.live_group_stages() + if previous_round: + matches.extend(current_round.get_matches_recursive(True)) + matches.extend(previous_round.get_matches_recursive(True)) + else: + matches.extend(current_round.all_matches(True)) + group_stages = self.live_group_stages() return matches, group_stages