mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-24 03:02:23 +00:00
Display the team ranking
This commit is contained in:
parent
61703b130d
commit
7397afd236
@ -10,7 +10,7 @@
|
||||
<div class="card-body">
|
||||
<dl class="row">
|
||||
<dt class="col-sm-3">{% trans "Tournament:" %}</dt>
|
||||
<dd class="col-sm-9">{{ pool.tournament }}</dd>
|
||||
<dd class="col-sm-9"><a href="{{ pool.tournament.get_absolute_url }}">{{ pool.tournament }}</a></dd>
|
||||
|
||||
<dt class="col-sm-3">{% trans "Round:" %}</dt>
|
||||
<dd class="col-sm-9">{{ pool.get_round_display }}</dd>
|
||||
@ -34,10 +34,23 @@
|
||||
<dt class="col-sm-3">{% trans "Defended solutions:" %}</dt>
|
||||
<dd class="col-sm-9">
|
||||
{% for passage in pool.passages.all %}
|
||||
<a href="{{ passage.defended_solution.get_absolute_url }}" data-turbolinks="false">{{ passage.defended_solution }}{% if not forloop.last %}, {% endif %}</a>
|
||||
<a href="{{ passage.defended_solution.file.url }}" data-turbolinks="false">{{ passage.defended_solution }}{% if not forloop.last %}, {% endif %}</a>
|
||||
{% endfor %}
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<div class="card bg-light shadow">
|
||||
<div class="card-header text-center">
|
||||
<h5>{% trans "Ranking" %}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
{% for participation, note in notes %}
|
||||
<li><strong>{{ participation.team }} :</strong> {{ note }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if user.registration.is_admin %}
|
||||
<div class="card-footer text-center">
|
||||
|
@ -72,6 +72,21 @@
|
||||
<button class="btn btn-block btn-success" data-toggle="modal" data-target="#addPoolModal">{% trans "Add new pool" %}</button>
|
||||
{% endif %}
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="card bg-light shadow">
|
||||
<div class="card-header text-center">
|
||||
<h5>{% trans "Ranking" %}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
{% for participation, note in notes %}
|
||||
<li><strong>{{ participation.team }} :</strong> {{ note }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% trans "Add pool" as modal_title %}
|
||||
{% trans "Add" as modal_button %}
|
||||
{% url "participation:pool_create" as modal_action %}
|
||||
|
@ -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
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: TFJM\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-01-14 18:57+0100\n"
|
||||
"POT-Creation-Date: 2021-01-14 19:22+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -478,9 +478,9 @@ msgstr "Rejoindre"
|
||||
#: apps/participation/templates/participation/passage_detail.html:44
|
||||
#: apps/participation/templates/participation/passage_detail.html:100
|
||||
#: apps/participation/templates/participation/passage_detail.html:105
|
||||
#: apps/participation/templates/participation/pool_detail.html:45
|
||||
#: apps/participation/templates/participation/pool_detail.html:57
|
||||
#: apps/participation/templates/participation/pool_detail.html:62
|
||||
#: apps/participation/templates/participation/pool_detail.html:58
|
||||
#: apps/participation/templates/participation/pool_detail.html:70
|
||||
#: apps/participation/templates/participation/pool_detail.html:75
|
||||
#: apps/participation/templates/participation/team_detail.html:84
|
||||
#: apps/participation/templates/participation/team_detail.html:143
|
||||
#: apps/participation/templates/participation/tournament_form.html:12
|
||||
@ -654,21 +654,26 @@ msgid "Defended solutions:"
|
||||
msgstr "Solutions défendues :"
|
||||
|
||||
#: apps/participation/templates/participation/pool_detail.html:44
|
||||
#: apps/participation/templates/participation/pool_detail.html:51
|
||||
#: apps/participation/templates/participation/tournament_detail.html:79
|
||||
msgid "Ranking"
|
||||
msgstr "Classement"
|
||||
|
||||
#: apps/participation/templates/participation/pool_detail.html:57
|
||||
#: apps/participation/templates/participation/pool_detail.html:64
|
||||
msgid "Add passage"
|
||||
msgstr "Ajouter un passage"
|
||||
|
||||
#: apps/participation/templates/participation/pool_detail.html:46
|
||||
#: apps/participation/templates/participation/pool_detail.html:61
|
||||
#: apps/participation/templates/participation/pool_detail.html:59
|
||||
#: apps/participation/templates/participation/pool_detail.html:74
|
||||
msgid "Update teams"
|
||||
msgstr "Modifier les équipes"
|
||||
|
||||
#: apps/participation/templates/participation/pool_detail.html:52
|
||||
#: apps/participation/templates/participation/tournament_detail.html:76
|
||||
#: apps/participation/templates/participation/pool_detail.html:65
|
||||
#: apps/participation/templates/participation/tournament_detail.html:91
|
||||
msgid "Add"
|
||||
msgstr "Ajouter"
|
||||
|
||||
#: apps/participation/templates/participation/pool_detail.html:56
|
||||
#: apps/participation/templates/participation/pool_detail.html:69
|
||||
#: apps/participation/templates/participation/pool_form.html:11
|
||||
msgid "Update pool"
|
||||
msgstr "Modifier la poule"
|
||||
@ -850,7 +855,7 @@ msgstr "Poules"
|
||||
msgid "Add new pool"
|
||||
msgstr "Ajouter une nouvelle poule"
|
||||
|
||||
#: apps/participation/templates/participation/tournament_detail.html:75
|
||||
#: apps/participation/templates/participation/tournament_detail.html:90
|
||||
msgid "Add pool"
|
||||
msgstr "Ajouter une poule"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user