diff --git a/tournaments/models/player_registration.py b/tournaments/models/player_registration.py index 9d00faa..aa0c4bf 100644 --- a/tournaments/models/player_registration.py +++ b/tournaments/models/player_registration.py @@ -104,20 +104,36 @@ class PlayerRegistration(SideStoreModel): if not self.team_registration: return None + tournament = self.team_registration.tournament + tournament_status_team_count = tournament.get_tournament_status_team_count() status = { + 'header': "Équipes", + 'position': tournament_status_team_count, 'display_box': True, 'box_class': 'gray', 'short_label': 'inscrit' } - tournament = self.team_registration.tournament team = self.team_registration # Tournament is ended with results if tournament.get_online_registration_status() is OnlineRegistrationStatus.ENDED_WITH_RESULTS: if team.get_final_ranking_component(): - status['box_class'] = 'light-green' - status['short_label'] = team.get_final_ranking_component() + status['header'] = 'Rang' + status['position'] = f"{team.get_final_ranking_component()} / {tournament_status_team_count}" + + if tournament.display_points_earned and team.points_earned: + if team.final_ranking == 1: + status['box_class'] = 'light-gold' + elif team.final_ranking == 2: + status['box_class'] = 'light-silver' + elif team.final_ranking == 3: + status['box_class'] = 'light-bronze' + else: + status['box_class'] = 'light-beige' + status['short_label'] = f"{team.points_earned} pts" + else: + status['box_class'] = False return status # Team has walked out diff --git a/tournaments/static/tournaments/css/style.css b/tournaments/static/tournaments/css/style.css index 33861dd..4194c79 100644 --- a/tournaments/static/tournaments/css/style.css +++ b/tournaments/static/tournaments/css/style.css @@ -691,6 +691,23 @@ h-margin { color: white !important; } +.light-gold { + background-color: gold !important; +} + +.light-silver { + background-color: silver !important; +} + +.light-bronze { + background-color: #cd7f32 !important; + color: white !important; +} + +.light-beige { + background-color: #fae7ce !important; +} + .table-row-element { width: 100%; line-height: 1.2; diff --git a/tournaments/templates/tournaments/tournament_row.html b/tournaments/templates/tournaments/tournament_row.html index 2722441..8bb0183 100644 --- a/tournaments/templates/tournaments/tournament_row.html +++ b/tournaments/templates/tournaments/tournament_row.html @@ -21,17 +21,19 @@
{{ tournament.localized_day_duration }}
-
Équipes
-
{{ tournament.get_tournament_status_team_count }}
{% if user.is_authenticated %} {% with user_registration_status=tournament|get_player_status:user %} {% if user_registration_status %} +
{{ user_registration_status.header }}
+
{{ user_registration_status.position }}
{% if user_registration_status.display_box %}
{{ user_registration_status.short_label }}
{% endif %} {% else %} +
Équipes
+
{{ tournament.get_tournament_status_team_count }}
{% if status.display_box %}
{{ status.short_label }} @@ -40,6 +42,8 @@ {% endif %} {% endwith %} {% else %} +
Équipes
+
{{ tournament.get_tournament_status_team_count }}
{% if status.display_box %}
{{ status.short_label }}