1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 05:42:23 +00:00

Don't display notes too early

This commit is contained in:
Yohann D'ANELLO 2021-01-18 16:54:57 +01:00
parent 70d2ade6a3
commit b0e43959eb
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 23 additions and 17 deletions

View File

@ -61,9 +61,9 @@
{% render_table teams %} {% render_table teams %}
</div> </div>
{% if pools.data %}
<hr> <hr>
{% if pools.data %}
<h3>{% trans "Pools" %}</h3> <h3>{% trans "Pools" %}</h3>
<div id="pools_table"> <div id="pools_table">
{% render_table pools %} {% render_table pools %}
@ -74,6 +74,7 @@
<button class="btn btn-block btn-success" data-toggle="modal" data-target="#addPoolModal">{% trans "Add new pool" %}</button> <button class="btn btn-block btn-success" data-toggle="modal" data-target="#addPoolModal">{% trans "Add new pool" %}</button>
{% endif %} {% endif %}
{% if notes %}
<hr> <hr>
<div class="card bg-light shadow"> <div class="card bg-light shadow">
@ -88,6 +89,7 @@
</ul> </ul>
</div> </div>
</div> </div>
{% endif %}
{% if user.registration.is_admin %} {% if user.registration.is_admin %}
{% trans "Add pool" as modal_title %} {% trans "Add pool" as modal_title %}

View File

@ -466,8 +466,10 @@ class TournamentDetailView(DetailView):
notes = dict() notes = dict()
for participation in self.object.participations.all(): for participation in self.object.participations.all():
notes[participation] = sum(pool.average(participation) 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 note:
notes[participation] = note
context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True) context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True)
return context return context
@ -536,7 +538,9 @@ class PoolDetailView(LoginRequiredMixin, DetailView):
notes = dict() notes = dict()
for participation in self.object.participations.all(): for participation in self.object.participations.all():
notes[participation] = self.object.average(participation) note = self.object.average(participation)
if note:
notes[participation] = note
context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True) context["notes"] = sorted(notes.items(), key=lambda x: x[1], reverse=True)
return context return context