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