From 50d874026037ae0cf1e6d4aac8e868ccdb14e178 Mon Sep 17 00:00:00 2001 From: Raz Date: Wed, 19 Mar 2025 10:42:42 +0100 Subject: [PATCH] fix nav in team details and wc stuff --- tournaments/models/group_stage.py | 6 +++++- tournaments/models/team_registration.py | 14 +++++++++++++- tournaments/models/team_score.py | 5 ++++- tournaments/models/tournament.py | 6 +++++- .../broadcast/broadcasted_group_stage.html | 2 +- .../templates/tournaments/group_stage_cell.html | 6 +++--- tournaments/templates/tournaments/match_cell.html | 4 ++-- .../templates/tournaments/team_details.html | 3 ++- tournaments/templates/tournaments/team_row.html | 4 ++-- 9 files changed, 37 insertions(+), 13 deletions(-) diff --git a/tournaments/models/group_stage.py b/tournaments/models/group_stage.py index 76b5d11..b86ecfa 100644 --- a/tournaments/models/group_stage.py +++ b/tournaments/models/group_stage.py @@ -199,7 +199,11 @@ class GroupStageTeam: self.set_diff = 0 self.game_diff = 0 self.display_set_difference = False - self.weight = team_registration.weight + if team_registration.playerregistration_set.count() == 0: + weight = None + else: + weight = team_registration.weight + self.weight = weight self.team_registration = team_registration self.qualified = team_registration.qualified diff --git a/tournaments/models/team_registration.py b/tournaments/models/team_registration.py index 6fcca5b..5cb4439 100644 --- a/tournaments/models/team_registration.py +++ b/tournaments/models/team_registration.py @@ -58,7 +58,12 @@ class TeamRegistration(models.Model): else: players = list(self.playerregistration_set.all()) if len(players) == 0: - return [] + if self.wild_card_bracket: + return ['Place réservée wildcard'] + elif self.wild_card_group_stage: + return ['Place réservée wildcard'] + else: + return ['Place réservée'] elif len(players) == 1: return [players[0].shortened_name()] else: @@ -270,3 +275,10 @@ class TeamRegistration(models.Model): if p.registered_online: return True return False + + def formatted_special_status(self): + if self.wild_card_bracket: + return "(wildcard tableau)" + if self.wild_card_group_stage: + return "(wildcard poule)" + return "" diff --git a/tournaments/models/team_score.py b/tournaments/models/team_score.py index 9e22b12..4c23ade 100644 --- a/tournaments/models/team_score.py +++ b/tournaments/models/team_score.py @@ -87,8 +87,11 @@ class TeamScore(models.Model): if self.team_registration: id = self.team_registration.id image = self.team_registration.logo - weight = self.team_registration.weight is_winner = self.team_registration.id == match.winning_team_id + if self.team_registration.playerregistration_set.count() == 0: + weight = None + else: + weight = self.team_registration.weight else: id = None image = None diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index b30a4f6..2d6ba1f 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -1437,7 +1437,11 @@ class TeamItem: self.names = team_registration.team_names() self.date = team_registration.local_call_date() self.registration_date = team_registration.registration_date - self.weight = team_registration.weight + if team_registration.playerregistration_set.count() == 0: + weight = None + else: + weight = team_registration.weight + self.weight = weight self.initial_weight = team_registration.initial_weight() self.image = team_registration.logo self.stage = "" diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_group_stage.html b/tournaments/templates/tournaments/broadcast/broadcasted_group_stage.html index 6371829..2c3556d 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_group_stage.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_group_stage.html @@ -34,7 +34,7 @@
-
+
diff --git a/tournaments/templates/tournaments/group_stage_cell.html b/tournaments/templates/tournaments/group_stage_cell.html index 489d851..f97a9e5 100644 --- a/tournaments/templates/tournaments/group_stage_cell.html +++ b/tournaments/templates/tournaments/group_stage_cell.html @@ -14,7 +14,7 @@
- {% if team.team_registration.id %} + {% if team.team_registration.id and team.weight %} {% endif %} @@ -24,7 +24,7 @@
{% endfor %} - {% if team.team_registration.id %} + {% if team.team_registration.id and team.weight %} {% endif %} @@ -36,7 +36,7 @@ {% else %} {% if tournament.hide_weight %}
- {% else %} + {% elif team.weight %}
{{ team.weight }}
{% endif %} {% endif %} diff --git a/tournaments/templates/tournaments/match_cell.html b/tournaments/templates/tournaments/match_cell.html index 86792bf..d1f4837 100644 --- a/tournaments/templates/tournaments/match_cell.html +++ b/tournaments/templates/tournaments/match_cell.html @@ -15,7 +15,7 @@ {% for team in match.teams %} diff --git a/tournaments/templates/tournaments/team_details.html b/tournaments/templates/tournaments/team_details.html index 4198121..d07d0e5 100644 --- a/tournaments/templates/tournaments/team_details.html +++ b/tournaments/templates/tournaments/team_details.html @@ -5,6 +5,7 @@ {% block second_title %}{{ tournament.display_name }}{% endblock %} {% block content %} +{% include 'tournaments/navigation_tournament.html' %}
-

{{ team.formatted_team_names }}

+

{{ team.formatted_team_names }} {{team.formatted_special_status}}

{% for player in team.playerregistration_set.all %} {% include 'tournaments/player_row.html' with player=player %} diff --git a/tournaments/templates/tournaments/team_row.html b/tournaments/templates/tournaments/team_row.html index 197b3c0..2418787 100644 --- a/tournaments/templates/tournaments/team_row.html +++ b/tournaments/templates/tournaments/team_row.html @@ -30,9 +30,9 @@
{% elif tournament.hide_weight %}
- {% elif not team.wildcard_bracket and not team.wildcard_groupstage %} + {% elif not team.wildcard_bracket and not team.wildcard_groupstage and team.weight %}
{{ team.weight }}
- {% elif team.names %} + {% elif team.names and team.weight %}
{{ team.weight }}
{% else %}