From a826bc7e79a97694b6e06d36112e7f08cb807883 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Fri, 24 May 2024 19:23:04 +0200 Subject: [PATCH] fix issue with teams algo --- tournaments/models/tournament.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index afb6511..3529a00 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -174,6 +174,7 @@ class Tournament(models.Model): complete_teams.append(team) if len(teams) < self.team_count: + teams.sort(key=lambda s: (s.initial_weight, s.date)) return teams seeds_count = min(self.team_count, len(teams)) - self.group_stage_count * self.teams_per_group_stage - len(wildcard_bracket)