diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 65fa4b9..6c38eba 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -196,9 +196,16 @@ class Tournament(models.Model): matches.extend(group_stage.match_set.all()) return matches + def group_stage_matches(self): + matches = [] + for group_stage in self.groupstage_set.all(): + matches.extend(group_stage.match_set.all()) + return matches + def group_stages_running(self): if len(self.groupstage_set.all()) > 0: - running_group_stage_matches = Match.objects.filter(group_stage__is_null=False, end_date=None) + matches = self.group_stage_matches() + running_group_stage_matches = [m for m in matches if m.end_date is None] return len(running_group_stage_matches) > 0 else: return False