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

Display notes iff results are public

This commit is contained in:
2021-04-10 09:59:04 +02:00
parent bb01e1b0b5
commit ef8d124ade
4 changed files with 114 additions and 69 deletions

View File

@ -539,7 +539,8 @@ class TournamentDetailView(DetailView):
notes = dict()
for participation in self.object.participations.all():
note = sum(pool.average(participation)
for pool in self.object.pools.filter(participations=participation).all())
for pool in self.object.pools.filter(participations=participation).all()
if pool.results_available or self.request.user.registration.is_volunteer)
if note:
notes[participation] = note
context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True)
@ -616,12 +617,14 @@ class PoolDetailView(LoginRequiredMixin, DetailView):
context["passages"] = PassageTable(self.object.passages.all())
notes = dict()
for participation in self.object.participations.all():
note = self.object.average(participation)
if note:
notes[participation] = note
context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True)
if self.object.results_available or self.request.user.registration.is_volunteer:
# Hide notes before the end of the turn
notes = dict()
for participation in self.object.participations.all():
note = self.object.average(participation)
if note:
notes[participation] = note
context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True)
return context