From 6e95a8acbce93674bdcd204e1c916f932b09b4ea Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Sun, 2 Jun 2024 07:53:23 +0200 Subject: [PATCH 1/3] fix sorting end tournament --- tournaments/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tournaments/views.py b/tournaments/views.py index ef431ec..7d5e839 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -65,7 +65,7 @@ def index(request): if tournament.supposedly_in_progress() and tournament.display_tournament(): live_tournaments.append(tournament) - ended_tournaments = Tournament.objects.filter(*q_ended).order_by('start_date') + ended_tournaments = Tournament.objects.filter(*q_ended).order_by('-start_date') filtered_ended_tournaments = [] for tournament in ended_tournaments: From e9c819cec88c17fba6698068c7bd34a107b29b01 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Sun, 2 Jun 2024 09:41:08 +0200 Subject: [PATCH 2/3] add tournament_status_display method --- tournaments/models/tournament.py | 5 ++++- tournaments/templates/tournaments/tournament_row.html | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 100ffce..eb76030 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -124,7 +124,10 @@ class Tournament(models.Model): else: return None - def team_count_display(self): + def tournament_status_display(self): + if self.is_canceled: + return "Annulé" + teams = self.teams() if teams is not None and len(teams) > 0: return f"{len(teams)} inscriptions" diff --git a/tournaments/templates/tournaments/tournament_row.html b/tournaments/templates/tournaments/tournament_row.html index 1a64ac0..8cd564f 100644 --- a/tournaments/templates/tournaments/tournament_row.html +++ b/tournaments/templates/tournaments/tournament_row.html @@ -22,13 +22,13 @@ {% endif %} - {% if tournament.team_count_display %} -
{{ tournament.team_count_display }}
+ {% if tournament.tournament_status_display %} +
{{ tournament.tournament_status_display }}
{% endif %}
{{ tournament.formatted_start_date }}
- {% if tournament.team_count_display %} -
{{ tournament.team_count_display }}
+ {% if tournament.tournament_status_display %} +
{{ tournament.tournament_status_display }}
{% endif %}
From 01cca8f8e2c0900c4f0946e2c9e7c5ac3c99309e Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Sun, 2 Jun 2024 09:42:02 +0200 Subject: [PATCH 3/3] add tournament_status_display method --- tournaments/models/tournament.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index eb76030..27d927e 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -125,8 +125,8 @@ class Tournament(models.Model): return None def tournament_status_display(self): - if self.is_canceled: - return "Annulé" + #if self.is_canceled: + # return "Annulé" teams = self.teams() if teams is not None and len(teams) > 0: