diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 3378b22..eba470b 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -68,7 +68,7 @@ class Tournament(models.Model): return summons - def live_matches(self): + def live_matches(self, broadcasted): matches = [] for group_stage in self.groupstage_set.all(): for match in group_stage.match_set.all(): @@ -77,8 +77,11 @@ class Tournament(models.Model): for match in round.match_set.all(): matches.append(match) - matches = [m for m in matches if m.broadcasted==True] - # matches = [m for m in matches if len(m.team_scores.all()) > 0] + if broadcasted: + matches = [m for m in matches if m.broadcasted==True] + if not broadcasted: + matches = [m for m in matches if len(m.team_scores.all()) > 0] + matches.sort(key=lambda m: m.order) return [match.live_match() for match in matches] diff --git a/tournaments/templates/tournaments/broadcasted_matches.html b/tournaments/templates/tournaments/broadcasted_matches.html index f01256d..9af969d 100644 --- a/tournaments/templates/tournaments/broadcasted_matches.html +++ b/tournaments/templates/tournaments/broadcasted_matches.html @@ -70,7 +70,7 @@
- +