From f457a2355ed36412f64bc7ae2f8e649b471e88cc Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Thu, 18 Apr 2024 15:22:59 +0200 Subject: [PATCH] Display scores of all teams in a 5-teams pool Signed-off-by: Emmy D'Anello --- participation/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/participation/views.py b/participation/views.py index ae3a67a..615d5e1 100644 --- a/participation/views.py +++ b/participation/views.py @@ -936,7 +936,10 @@ class PoolDetailView(LoginRequiredMixin, DetailView): # Hide notes before the end of the turn notes = dict() for participation in self.object.participations.all(): - note = self.object.average(participation) + # For a 5-teams pool, notes are separated in 2 different pool objects, so we fetch them all + all_pools = self.object.tournament.pools.filter(round=self.object.round, + letter=self.object.letter).all() + note = sum(pool.average(participation) for pool in all_pools) if note: notes[participation] = note context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True)