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 @@
-
diff --git a/tournaments/templates/tournaments/broadcasted_group_stages.html b/tournaments/templates/tournaments/broadcasted_group_stages.html index 9638c2c..1c514d5 100644 --- a/tournaments/templates/tournaments/broadcasted_group_stages.html +++ b/tournaments/templates/tournaments/broadcasted_group_stages.html @@ -75,87 +75,65 @@ diff --git a/tournaments/templates/tournaments/broadcasted_match.html b/tournaments/templates/tournaments/broadcasted_match.html index 8b6df27..dd4b370 100644 --- a/tournaments/templates/tournaments/broadcasted_match.html +++ b/tournaments/templates/tournaments/broadcasted_match.html @@ -21,7 +21,7 @@ html += `` return html }, - }" x-html="showName(name, match.teams[i-1])"> + }" x-html="showName(name, match.teams[i-1])">
diff --git a/tournaments/templates/tournaments/broadcasted_summons.html b/tournaments/templates/tournaments/broadcasted_summons.html index 157e74b..01e64b6 100644 --- a/tournaments/templates/tournaments/broadcasted_summons.html +++ b/tournaments/templates/tournaments/broadcasted_summons.html @@ -1,7 +1,7 @@ {% extends 'tournaments/broadcast_base.html' %} {% block head_title %}Convocations{% endblock %} -{% block first_title %}{{ tournament.name }}{% endblock %} +{% block first_title %}{{ tournament.display_name }}{% endblock %} {% block second_title %}Convocations{% endblock %} {% block content %}