1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-08-04 15:31:07 +02:00

Display the team ranking

This commit is contained in:
Yohann D'ANELLO
2021-01-14 19:23:32 +01:00
parent 61703b130d
commit 7397afd236
4 changed files with 63 additions and 13 deletions

View File

@@ -435,6 +435,13 @@ class TournamentDetailView(DetailView):
context = super().get_context_data(**kwargs)
context["teams"] = ParticipationTable(self.object.participations.all())
context["pools"] = PoolTable(self.object.pools.all())
notes = dict()
for participation in self.object.participations.all():
notes[participation] = sum(pool.average(participation)
for pool in self.object.pools.filter(participations=participation).all())
context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True)
return context
@@ -479,6 +486,16 @@ class PoolCreateView(AdminMixin, CreateView):
class PoolDetailView(LoginRequiredMixin, DetailView):
model = Pool
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
notes = dict()
for participation in self.object.participations.all():
notes[participation] = self.object.average(participation)
context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True)
return context
class PoolUpdateView(AdminMixin, UpdateView):
model = Pool