update position / rank in tournament row

sync_v2
Raz 7 months ago
parent f3894c2db5
commit f1a223a094
  1. 22
      tournaments/models/player_registration.py
  2. 17
      tournaments/static/tournaments/css/style.css
  3. 8
      tournaments/templates/tournaments/tournament_row.html

@ -104,20 +104,36 @@ class PlayerRegistration(SideStoreModel):
if not self.team_registration: if not self.team_registration:
return None return None
tournament = self.team_registration.tournament
tournament_status_team_count = tournament.get_tournament_status_team_count()
status = { status = {
'header': "Équipes",
'position': tournament_status_team_count,
'display_box': True, 'display_box': True,
'box_class': 'gray', 'box_class': 'gray',
'short_label': 'inscrit' 'short_label': 'inscrit'
} }
tournament = self.team_registration.tournament
team = self.team_registration team = self.team_registration
# Tournament is ended with results # Tournament is ended with results
if tournament.get_online_registration_status() is OnlineRegistrationStatus.ENDED_WITH_RESULTS: if tournament.get_online_registration_status() is OnlineRegistrationStatus.ENDED_WITH_RESULTS:
if team.get_final_ranking_component(): if team.get_final_ranking_component():
status['box_class'] = 'light-green' status['header'] = 'Rang'
status['short_label'] = team.get_final_ranking_component() 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 return status
# Team has walked out # Team has walked out

@ -691,6 +691,23 @@ h-margin {
color: white !important; 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 { .table-row-element {
width: 100%; width: 100%;
line-height: 1.2; line-height: 1.2;

@ -21,17 +21,19 @@
<div class="small">{{ tournament.localized_day_duration }}</div> <div class="small">{{ tournament.localized_day_duration }}</div>
</div> </div>
<div class="table-row-element tournament-status center"> <div class="table-row-element tournament-status center">
<div class="small">Équipes</div>
<div class="very-large">{{ tournament.get_tournament_status_team_count }}</div>
{% if user.is_authenticated %} {% if user.is_authenticated %}
{% with user_registration_status=tournament|get_player_status:user %} {% with user_registration_status=tournament|get_player_status:user %}
{% if user_registration_status %} {% if user_registration_status %}
<div class="small">{{ user_registration_status.header }}</div>
<div class="very-large">{{ user_registration_status.position }}</div>
{% if user_registration_status.display_box %} {% if user_registration_status.display_box %}
<div class="box small {{ user_registration_status.box_class }}"> <div class="box small {{ user_registration_status.box_class }}">
{{ user_registration_status.short_label }} {{ user_registration_status.short_label }}
</div> </div>
{% endif %} {% endif %}
{% else %} {% else %}
<div class="small">Équipes</div>
<div class="very-large">{{ tournament.get_tournament_status_team_count }}</div>
{% if status.display_box %} {% if status.display_box %}
<div class="box small {{ status.box_class }}"> <div class="box small {{ status.box_class }}">
{{ status.short_label }} {{ status.short_label }}
@ -40,6 +42,8 @@
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% else %} {% else %}
<div class="small">Équipes</div>
<div class="very-large">{{ tournament.get_tournament_status_team_count }}</div>
{% if status.display_box %} {% if status.display_box %}
<div class="box small {{ status.box_class }}"> <div class="box small {{ status.box_class }}">
{{ status.short_label }} {{ status.short_label }}

Loading…
Cancel
Save