From ba671c41f75f1809c02303d47d8a4a9452a6c5c5 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Fri, 30 May 2025 08:05:45 +0200 Subject: [PATCH] fix float format in fees --- tournaments/models/tournament.py | 11 +++++++++-- tournaments/templates/register_tournament.html | 2 +- .../templates/tournaments/tournament_info.html | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 43e3b44..71a6066 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -1108,14 +1108,18 @@ class Tournament(BaseModel): return True def options_fee(self): + def format_currency(amount): + """Format currency amount, removing unnecessary decimals""" + return f"{amount:g}" if amount % 1 == 0 else f"{amount:.2f}" + options = [] # Entry fee if self.entry_fee is not None and self.entry_fee > 0: - options.append(f"Frais d'inscription: {self.entry_fee} € par joueur") + options.append(f"Frais d'inscription: {format_currency(self.entry_fee)} € par joueur") # Club member fee reduction if self.club_member_fee_deduction and self.club_member_fee_deduction > 0: - options.append(f"Réduction de {self.club_member_fee_deduction} € pour les membres du club") + options.append(f"Réduction de {format_currency(self.club_member_fee_deduction)} € pour les membres du club") return options @@ -1133,6 +1137,9 @@ class Tournament(BaseModel): date = formats.date_format(self.registration_date_limit.astimezone(timezone), format='j F Y H:i') options.append(f"Clôture des inscriptions le {date}") + # Période de désinscription + options.append(f"Désinscription possible jusqu'à {self.unregister_delta_in_hours}h avant le tournoi") + options.append(self.get_selection_status_localized) # Cible d'équipes diff --git a/tournaments/templates/register_tournament.html b/tournaments/templates/register_tournament.html index 3f1a1a7..91117e8 100644 --- a/tournaments/templates/register_tournament.html +++ b/tournaments/templates/register_tournament.html @@ -197,7 +197,7 @@ Confirmer votre inscription en payant immédiatement : {% endif %} {% if tournament.should_request_payment is False or tournament.online_payment_is_mandatory is False or cart_data.waiting_list_position >= 0 %} diff --git a/tournaments/templates/tournaments/tournament_info.html b/tournaments/templates/tournaments/tournament_info.html index 72d6f94..875390c 100644 --- a/tournaments/templates/tournaments/tournament_info.html +++ b/tournaments/templates/tournaments/tournament_info.html @@ -102,9 +102,9 @@ {% else %} {% if team.needs_confirmation %} - Confirmer en payant ({{ team.get_remaining_fee }}€) + Confirmer en payant {{ team.get_remaining_fee|floatformat:2 }}€ {% else %} - Procéder au paiement ({{ team.get_remaining_fee }}€) + Procéder au paiement de {{ team.get_remaining_fee|floatformat:2 }}€ {% endif %} {% endif %}