diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 94846d3..16475b1 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -269,15 +269,21 @@ class Tournament(models.Model): groups = [] for round in self.round_set.filter(parent=None).all().order_by('index'): groups.extend(self.round_match_groups(round, broadcasted, hide_empty_matches=True)) - for group_stage in self.groupstage_set.all(): - group = self.group_stage_match_group(group_stage, broadcasted, hide_empty_matches=True) - if group: - groups.append(group) + + if self.display_group_stages(): + for group_stage in self.groupstage_set.all().order_by('index'): + group = self.group_stage_match_group(group_stage, broadcasted, hide_empty_matches=True) + if group: + groups.append(group) + return groups def group_stage_match_group(self, group_stage, broadcasted, hide_empty_matches): matches = group_stage.match_set.all() - matches = [m for m in matches if m.should_appear()] + if hide_empty_matches: + matches = [m for m in matches if m.should_appear()] + else: + matches = [m for m in matches if m.disabled is False] if matches: return self.create_match_group(group_stage.display_name(), matches, broadcasted) @@ -288,18 +294,22 @@ class Tournament(models.Model): groups = [] matches = round.match_set.order_by('index').all() - matches = [m for m in matches if m.should_appear()] + if hide_empty_matches: + matches = [m for m in matches if m.should_appear()] + else: + matches = [m for m in matches if m.disabled is False] - if matches: - round_matches = round.match_set.all() - if hide_empty_matches: - round_matches = [m for m in round_matches if m.should_appear()] - group = self.create_match_group(round.name(), round_matches, broadcasted) + if matches: + group = self.create_match_group(round.name(), matches, broadcasted) groups.append(group) ranking_matches = round.ranking_matches(hide_empty_matches) - ranking_matches = [m for m in ranking_matches if m.should_appear()] + if hide_empty_matches: + ranking_matches = [m for m in ranking_matches if m.should_appear()] + else: + ranking_matches = [m for m in ranking_matches if m.disabled is False] + if len(ranking_matches) > 0: group = self.create_match_group('Matchs de classement', ranking_matches, broadcasted) groups.append(group) diff --git a/tournaments/templates/tournaments/matches.html b/tournaments/templates/tournaments/matches.html index 8c944cb..9080ded 100644 --- a/tournaments/templates/tournaments/matches.html +++ b/tournaments/templates/tournaments/matches.html @@ -13,9 +13,12 @@ {% if rounds or group_stages %}