diff --git a/apps/participation/templates/participation/tournament_detail.html b/apps/participation/templates/participation/tournament_detail.html index 33bf9e6..b7fc4c4 100644 --- a/apps/participation/templates/participation/tournament_detail.html +++ b/apps/participation/templates/participation/tournament_detail.html @@ -61,9 +61,9 @@ {% render_table teams %} -
- {% if pools.data %} +
+

{% trans "Pools" %}

{% render_table pools %} @@ -74,20 +74,22 @@ {% endif %} -
+ {% if notes %} +
-
-
-
{% trans "Ranking" %}
+
+
+
{% trans "Ranking" %}
+
+
+
    + {% for participation, note in notes %} +
  • {{ participation.team }} : {{ note }}
  • + {% endfor %} +
+
-
-
    - {% for participation, note in notes %} -
  • {{ participation.team }} : {{ note }}
  • - {% endfor %} -
-
-
+ {% endif %} {% if user.registration.is_admin %} {% trans "Add pool" as modal_title %} diff --git a/apps/participation/views.py b/apps/participation/views.py index e0ad4db..aca6a90 100644 --- a/apps/participation/views.py +++ b/apps/participation/views.py @@ -466,8 +466,10 @@ class TournamentDetailView(DetailView): 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()) + note = sum(pool.average(participation) + 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) return context @@ -536,7 +538,9 @@ class PoolDetailView(LoginRequiredMixin, DetailView): notes = dict() 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) return context