From 5cee2bdf12d1973796a1f25701a5d32c6e5a4d45 Mon Sep 17 00:00:00 2001 From: Raz Date: Mon, 19 Aug 2024 10:59:09 +0200 Subject: [PATCH] fix issue with no teams count displayed when tournament is over --- tournaments/models/tournament.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 1541ea6..4665aed 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -160,7 +160,16 @@ class Tournament(models.Model): return "Annulé" teams = self.teams() - if self.supposedly_in_progress() or self.end_date is not None: + if self.end_date is not None: + count = self.team_count + if count > 0: + word = "équipe" + if count > 1: + word = word + "s" + return f"{count} {word}" + else: + return None + if self.supposedly_in_progress(): teams = [t for t in teams if t.stage != "Attente"] if teams is not None and len(teams) > 0: word = "équipe"