From 0a6b4614feaf1f63365f15bd053a1b506d265e04 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 28 Jul 2025 10:26:44 +0200 Subject: [PATCH] performance improvement --- tournaments/models/round.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tournaments/models/round.py b/tournaments/models/round.py index d4d773e..1f5d43a 100644 --- a/tournaments/models/round.py +++ b/tournaments/models/round.py @@ -55,8 +55,10 @@ class Round(TournamentSubModel): return name def ranking_matches(self, hide_empty_matches): + + children_with_matches = self.children.prefetch_related('matches') matches = [] - for child in self.children.all(): + for child in children_with_matches: child_matches = child.matches.all() if hide_empty_matches: