mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-02-18 23:41:19 +00:00
Compare commits
2 Commits
61703b130d
...
1a7a411e10
Author | SHA1 | Date | |
---|---|---|---|
|
1a7a411e10 | ||
|
7397afd236 |
@ -6,7 +6,7 @@ from django.utils.text import format_lazy
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from .models import Note, Pool, Team, Tournament
|
from .models import Note, Passage, Pool, Team, Tournament
|
||||||
|
|
||||||
|
|
||||||
# noinspection PyTypeChecker
|
# noinspection PyTypeChecker
|
||||||
@ -98,6 +98,31 @@ class PoolTable(tables.Table):
|
|||||||
template_name = 'django_tables2/bootstrap4.html'
|
template_name = 'django_tables2/bootstrap4.html'
|
||||||
|
|
||||||
|
|
||||||
|
class PassageTable(tables.Table):
|
||||||
|
defender = tables.LinkColumn(
|
||||||
|
"participation:passage_detail",
|
||||||
|
args=[tables.A("id")],
|
||||||
|
verbose_name=_("defender").capitalize,
|
||||||
|
)
|
||||||
|
|
||||||
|
def render_defender(self, value):
|
||||||
|
return value.team
|
||||||
|
|
||||||
|
def render_opponent(self, value):
|
||||||
|
return value.team
|
||||||
|
|
||||||
|
def render_reporter(self, value):
|
||||||
|
return value.team
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
attrs = {
|
||||||
|
'class': 'table table-condensed table-striped text-center',
|
||||||
|
}
|
||||||
|
model = Passage
|
||||||
|
fields = ('defender', 'opponent', 'reporter', 'place',)
|
||||||
|
template_name = 'django_tables2/bootstrap4.html'
|
||||||
|
|
||||||
|
|
||||||
class NoteTable(tables.Table):
|
class NoteTable(tables.Table):
|
||||||
jury = tables.Column(
|
jury = tables.Column(
|
||||||
attrs={
|
attrs={
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load django_tables2 i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="card bg-light shadow">
|
<div class="card bg-light shadow">
|
||||||
@ -10,7 +10,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class="col-sm-3">{% trans "Tournament:" %}</dt>
|
<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>
|
<dt class="col-sm-3">{% trans "Round:" %}</dt>
|
||||||
<dd class="col-sm-9">{{ pool.get_round_display }}</dd>
|
<dd class="col-sm-9">{{ pool.get_round_display }}</dd>
|
||||||
@ -25,19 +25,26 @@
|
|||||||
<dt class="col-sm-3">{% trans "Juries:" %}</dt>
|
<dt class="col-sm-3">{% trans "Juries:" %}</dt>
|
||||||
<dd class="col-sm-9">{{ pool.juries.all|join:", " }}</dd>
|
<dd class="col-sm-9">{{ pool.juries.all|join:", " }}</dd>
|
||||||
|
|
||||||
<dt class="col-sm-3">{% trans "Passages:" %}</dt>
|
|
||||||
<dd class="col-sm-9">
|
|
||||||
{% for passage in pool.passages.all %}
|
|
||||||
<a href="{{ passage.get_absolute_url }}" data-turbolinks="false">{{ passage }}{% if not forloop.last %}, {% endif %}</a>
|
|
||||||
{% endfor %}
|
|
||||||
</dd>
|
|
||||||
<dt class="col-sm-3">{% trans "Defended solutions:" %}</dt>
|
<dt class="col-sm-3">{% trans "Defended solutions:" %}</dt>
|
||||||
<dd class="col-sm-9">
|
<dd class="col-sm-9">
|
||||||
{% for passage in pool.passages.all %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</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>
|
</div>
|
||||||
{% if user.registration.is_admin %}
|
{% if user.registration.is_admin %}
|
||||||
<div class="card-footer text-center">
|
<div class="card-footer text-center">
|
||||||
@ -48,6 +55,12 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<h3>{% trans "Passages" %}</h3>
|
||||||
|
|
||||||
|
{% render_table passages %}
|
||||||
|
|
||||||
{% trans "Add passage" as modal_title %}
|
{% trans "Add passage" as modal_title %}
|
||||||
{% trans "Add" as modal_button %}
|
{% trans "Add" as modal_button %}
|
||||||
{% url "participation:passage_create" pk=pool.pk as modal_action %}
|
{% url "participation:passage_create" pk=pool.pk as modal_action %}
|
||||||
|
@ -72,6 +72,21 @@
|
|||||||
<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 %}
|
||||||
|
|
||||||
|
<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 pool" as modal_title %}
|
||||||
{% trans "Add" as modal_button %}
|
{% trans "Add" as modal_button %}
|
||||||
{% url "participation:pool_create" as modal_action %}
|
{% url "participation:pool_create" as modal_action %}
|
||||||
|
@ -26,7 +26,7 @@ from tfjm.views import AdminMixin
|
|||||||
from .forms import JoinTeamForm, NoteForm, ParticipationForm, PassageForm, PoolForm, PoolTeamsForm, \
|
from .forms import JoinTeamForm, NoteForm, ParticipationForm, PassageForm, PoolForm, PoolTeamsForm, \
|
||||||
RequestValidationForm, TeamForm, TournamentForm, ValidateParticipationForm, SolutionForm, SynthesisForm
|
RequestValidationForm, TeamForm, TournamentForm, ValidateParticipationForm, SolutionForm, SynthesisForm
|
||||||
from .models import Note, Participation, Passage, Pool, Team, Tournament, Solution, Synthesis
|
from .models import Note, Participation, Passage, Pool, Team, Tournament, Solution, Synthesis
|
||||||
from .tables import TeamTable, TournamentTable, ParticipationTable, PoolTable, NoteTable
|
from .tables import NoteTable, PassageTable, PoolTable, TeamTable, TournamentTable, ParticipationTable
|
||||||
|
|
||||||
|
|
||||||
class CreateTeamView(LoginRequiredMixin, CreateView):
|
class CreateTeamView(LoginRequiredMixin, CreateView):
|
||||||
@ -435,6 +435,13 @@ class TournamentDetailView(DetailView):
|
|||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["teams"] = ParticipationTable(self.object.participations.all())
|
context["teams"] = ParticipationTable(self.object.participations.all())
|
||||||
context["pools"] = PoolTable(self.object.pools.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
|
return context
|
||||||
|
|
||||||
|
|
||||||
@ -479,6 +486,18 @@ class PoolCreateView(AdminMixin, CreateView):
|
|||||||
class PoolDetailView(LoginRequiredMixin, DetailView):
|
class PoolDetailView(LoginRequiredMixin, DetailView):
|
||||||
model = Pool
|
model = Pool
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
context["passages"] = PassageTable(self.object.passages.all())
|
||||||
|
|
||||||
|
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):
|
class PoolUpdateView(AdminMixin, UpdateView):
|
||||||
model = Pool
|
model = Pool
|
||||||
|
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: TFJM\n"
|
"Project-Id-Version: TFJM\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-01-14 18:57+0100\n"
|
"POT-Creation-Date: 2021-01-14 19:30+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
|
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -293,7 +293,7 @@ msgstr "solution défendue"
|
|||||||
msgid "Problem #{problem}"
|
msgid "Problem #{problem}"
|
||||||
msgstr "Problème n°{problem}"
|
msgstr "Problème n°{problem}"
|
||||||
|
|
||||||
#: apps/participation/models.py:356
|
#: apps/participation/models.py:356 apps/participation/tables.py:105
|
||||||
msgid "defender"
|
msgid "defender"
|
||||||
msgstr "défenseur"
|
msgstr "défenseur"
|
||||||
|
|
||||||
@ -478,9 +478,9 @@ msgstr "Rejoindre"
|
|||||||
#: apps/participation/templates/participation/passage_detail.html:44
|
#: apps/participation/templates/participation/passage_detail.html:44
|
||||||
#: apps/participation/templates/participation/passage_detail.html:100
|
#: apps/participation/templates/participation/passage_detail.html:100
|
||||||
#: apps/participation/templates/participation/passage_detail.html:105
|
#: apps/participation/templates/participation/passage_detail.html:105
|
||||||
#: apps/participation/templates/participation/pool_detail.html:45
|
#: apps/participation/templates/participation/pool_detail.html:52
|
||||||
#: apps/participation/templates/participation/pool_detail.html:57
|
#: apps/participation/templates/participation/pool_detail.html:68
|
||||||
#: apps/participation/templates/participation/pool_detail.html:62
|
#: apps/participation/templates/participation/pool_detail.html:73
|
||||||
#: apps/participation/templates/participation/team_detail.html:84
|
#: apps/participation/templates/participation/team_detail.html:84
|
||||||
#: apps/participation/templates/participation/team_detail.html:143
|
#: apps/participation/templates/participation/team_detail.html:143
|
||||||
#: apps/participation/templates/participation/tournament_form.html:12
|
#: apps/participation/templates/participation/tournament_form.html:12
|
||||||
@ -646,29 +646,34 @@ msgid "Juries:"
|
|||||||
msgstr "Jurys :"
|
msgstr "Jurys :"
|
||||||
|
|
||||||
#: apps/participation/templates/participation/pool_detail.html:28
|
#: apps/participation/templates/participation/pool_detail.html:28
|
||||||
msgid "Passages:"
|
|
||||||
msgstr "Passages :"
|
|
||||||
|
|
||||||
#: apps/participation/templates/participation/pool_detail.html:34
|
|
||||||
msgid "Defended solutions:"
|
msgid "Defended solutions:"
|
||||||
msgstr "Solutions défendues :"
|
msgstr "Solutions défendues :"
|
||||||
|
|
||||||
#: apps/participation/templates/participation/pool_detail.html:44
|
#: apps/participation/templates/participation/pool_detail.html:38
|
||||||
|
#: apps/participation/templates/participation/tournament_detail.html:79
|
||||||
|
msgid "Ranking"
|
||||||
|
msgstr "Classement"
|
||||||
|
|
||||||
#: apps/participation/templates/participation/pool_detail.html:51
|
#: apps/participation/templates/participation/pool_detail.html:51
|
||||||
|
#: apps/participation/templates/participation/pool_detail.html:62
|
||||||
msgid "Add passage"
|
msgid "Add passage"
|
||||||
msgstr "Ajouter un passage"
|
msgstr "Ajouter un passage"
|
||||||
|
|
||||||
#: apps/participation/templates/participation/pool_detail.html:46
|
#: apps/participation/templates/participation/pool_detail.html:53
|
||||||
#: apps/participation/templates/participation/pool_detail.html:61
|
#: apps/participation/templates/participation/pool_detail.html:72
|
||||||
msgid "Update teams"
|
msgid "Update teams"
|
||||||
msgstr "Modifier les équipes"
|
msgstr "Modifier les équipes"
|
||||||
|
|
||||||
#: apps/participation/templates/participation/pool_detail.html:52
|
#: apps/participation/templates/participation/pool_detail.html:60
|
||||||
#: apps/participation/templates/participation/tournament_detail.html:76
|
msgid "Passages"
|
||||||
|
msgstr "Passages"
|
||||||
|
|
||||||
|
#: apps/participation/templates/participation/pool_detail.html:63
|
||||||
|
#: apps/participation/templates/participation/tournament_detail.html:91
|
||||||
msgid "Add"
|
msgid "Add"
|
||||||
msgstr "Ajouter"
|
msgstr "Ajouter"
|
||||||
|
|
||||||
#: apps/participation/templates/participation/pool_detail.html:56
|
#: apps/participation/templates/participation/pool_detail.html:67
|
||||||
#: apps/participation/templates/participation/pool_form.html:11
|
#: apps/participation/templates/participation/pool_form.html:11
|
||||||
msgid "Update pool"
|
msgid "Update pool"
|
||||||
msgstr "Modifier la poule"
|
msgstr "Modifier la poule"
|
||||||
@ -850,7 +855,7 @@ msgstr "Poules"
|
|||||||
msgid "Add new pool"
|
msgid "Add new pool"
|
||||||
msgstr "Ajouter une nouvelle poule"
|
msgstr "Ajouter une nouvelle poule"
|
||||||
|
|
||||||
#: apps/participation/templates/participation/tournament_detail.html:75
|
#: apps/participation/templates/participation/tournament_detail.html:90
|
||||||
msgid "Add pool"
|
msgid "Add pool"
|
||||||
msgstr "Ajouter une poule"
|
msgstr "Ajouter une poule"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user