From 97c9cf32cd0a91ec444848aa9cdba8fb1a857d93 Mon Sep 17 00:00:00 2001 From: Raz Date: Thu, 24 Oct 2024 08:37:43 +0200 Subject: [PATCH] fix court and startdate display when not confirmed --- tournaments/models/match.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tournaments/models/match.py b/tournaments/models/match.py index 4e4695d..9dfda0d 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -41,6 +41,8 @@ class Match(models.Model): if self.tournament().event: club = self.tournament().event.club + if self.confirmed is False: + return "" if club: return club.court_name(index) elif index is not None: @@ -95,10 +97,16 @@ class Match(models.Model): return '' elif self.start_date: if self.started(): - return self.formatted_duration() + if self.confirmed: + return self.formatted_duration() + else: + return 'À suivre' else: timezoned_datetime = timezone.localtime(self.start_date) - return formats.date_format(timezoned_datetime, format='l H:i') + if self.confirmed: + return formats.date_format(timezoned_datetime, format='l H:i') + else: + return f"Estimée : {formats.date_format(timezoned_datetime, format='l H:i')}" else: return 'À venir...'