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:
@@ -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
|
||||
|
Reference in New Issue
Block a user