From 0d344be079d73618017bc8a7acdb3f4056c48572 Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 13 Jun 2024 10:16:40 +0200 Subject: [PATCH] Fix sorting #3 --- tournaments/models/tournament.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 289b149..39ea6fc 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -458,7 +458,7 @@ class Tournament(models.Model): matches.extend(group_stage.match_set.all()) matches = [m for m in matches if m.should_appear()] # matches.sort(key=lambda m: (m.non_null_start_date(), m.index), reverse=True) - matches.sort(key=lambda m: (m.start_date is not None, m.end_date is None, m.start_date, m.index)) + matches.sort(key=lambda m: (m.start_date is not None, m.start_date, m.end_date is None, m.index)) return matches