diff --git a/tournaments/models/team_registration.py b/tournaments/models/team_registration.py index be01bd1..89dc0cd 100644 --- a/tournaments/models/team_registration.py +++ b/tournaments/models/team_registration.py @@ -69,3 +69,6 @@ class TeamRegistration(models.Model): rank = player.rank if player.rank is not None else 0 weight += rank return weight + + def is_valid_for_summon(self): + return len(self.playerregistration_set.all()) > 0 diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index ee799c8..a4668fe 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -61,13 +61,14 @@ class Tournament(models.Model): def team_summons(self): summons = [] for team_registration in self.teamregistration_set.all(): - next_match = team_registration.next_match() - if next_match: - names = team_registration.team_names() - stage = next_match.stage_name() - weight = team_registration.weight() - summon = TeamSummon(names, next_match.start_date, weight, stage, team_registration.logo) - summons.append(summon) + if team_registration.is_valid_for_summon(): + next_match = team_registration.next_match() + if next_match: + names = team_registration.team_names() + stage = next_match.stage_name() + weight = team_registration.weight() + summon = TeamSummon(names, next_match.start_date, weight, stage, team_registration.logo) + summons.append(summon) summons.sort(key=lambda s: s.weight) return summons @@ -139,11 +140,6 @@ class Tournament(models.Model): def broadcast_content(self): - # now = timezone.now() - # matches_with_date = [match for match in self.all_matches() if match.start_date] - # today_matches = [match for match in today_matches if match.start_date.date() == now] - # matches_with_date.sort(key=lambda m: m.start_date) - matches, group_stages = self.broadcasted_matches_and_group_stages() group_stages_dicts = [gs.to_dict() for gs in group_stages] diff --git a/tournaments/templates/tournaments/broadcasted_group_stage.html b/tournaments/templates/tournaments/broadcasted_group_stage.html index 463a48a..856f0d6 100644 --- a/tournaments/templates/tournaments/broadcasted_group_stage.html +++ b/tournaments/templates/tournaments/broadcasted_group_stage.html @@ -2,42 +2,51 @@