Display notes iff results are public

This commit is contained in:
Yohann D'ANELLO 2021-04-10 09:59:04 +02:00
parent bb01e1b0b5
commit ef8d124ade
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
4 changed files with 114 additions and 69 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.7 on 2021-04-10 07:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('participation', '0004_passage_defender_penalties'),
]
operations = [
migrations.AddField(
model_name='pool',
name='results_available',
field=models.BooleanField(default=False, help_text='Check this case when results become accessible to teams. They stay accessible to you. Only averages are given.', verbose_name='results available'),
),
]

View File

@ -368,6 +368,13 @@ class Pool(models.Model):
help_text=_("The link of the BBB visio for this pool."),
)
results_available = models.BooleanField(
default=False,
verbose_name=_("results available"),
help_text=_("Check this case when results become accessible to teams. "
"They stay accessible to you. Only averages are given."),
)
@property
def solutions(self):
return Solution.objects.filter(participation__in=self.participations, final_solution=self.tournament.final)

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

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: TFJM\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-04-03 21:58+0200\n"
"POT-Creation-Date: 2021-04-10 09:57+0200\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"
@ -203,7 +203,7 @@ msgstr "début"
msgid "end"
msgstr "fin"
#: apps/participation/models.py:147 apps/participation/models.py:401
#: apps/participation/models.py:147 apps/participation/models.py:408
#: apps/participation/templates/participation/tournament_detail.html:18
msgid "place"
msgstr "lieu"
@ -286,8 +286,8 @@ msgstr "L'équipe est sélectionnée pour la finale."
msgid "Participation of the team {name} ({trigram})"
msgstr "Participation de l'équipe {name} ({trigram})"
#: apps/participation/models.py:331 apps/participation/models.py:530
#: apps/participation/models.py:568
#: apps/participation/models.py:331 apps/participation/models.py:537
#: apps/participation/models.py:575
msgid "participation"
msgstr "participation"
@ -316,49 +316,62 @@ msgstr "Lien BigBlueButton"
msgid "The link of the BBB visio for this pool."
msgstr "Le lien du salon BBB pour cette poule."
#: apps/participation/models.py:382
#: apps/participation/models.py:373
msgid "results available"
msgstr "résultats disponibles"
#: apps/participation/models.py:374
msgid ""
"Check this case when results become accessible to teams. They stay "
"accessible to you. Only averages are given."
msgstr ""
"Cochez cette case lorsque les résultats deviennent accessibles aux équipes. "
"Ils restent toujours accessibles pour vous. Seules les moyennes sont "
"communiquées."
#: apps/participation/models.py:389
#, python-brace-format
msgid "Pool {round} for tournament {tournament} with teams {teams}"
msgstr "Poule {round} du tournoi {tournament} avec les équipes {teams}"
#: apps/participation/models.py:388 apps/participation/models.py:396
#: apps/participation/models.py:395 apps/participation/models.py:403
msgid "pool"
msgstr "poule"
#: apps/participation/models.py:389
#: apps/participation/models.py:396
msgid "pools"
msgstr "poules"
#: apps/participation/models.py:403
#: apps/participation/models.py:410
msgid "Where the solution is presented?"
msgstr "Où est-ce que les solutions sont défendues ?"
#: apps/participation/models.py:408
#: apps/participation/models.py:415
msgid "defended solution"
msgstr "solution défendue"
#: apps/participation/models.py:410 apps/participation/models.py:537
#: apps/participation/models.py:417 apps/participation/models.py:544
#, python-brace-format
msgid "Problem #{problem}"
msgstr "Problème n°{problem}"
#: apps/participation/models.py:417 apps/participation/tables.py:106
#: apps/participation/models.py:424 apps/participation/tables.py:106
msgid "defender"
msgstr "défenseur"
#: apps/participation/models.py:424 apps/participation/models.py:580
#: apps/participation/models.py:431 apps/participation/models.py:587
msgid "opponent"
msgstr "opposant"
#: apps/participation/models.py:431 apps/participation/models.py:581
#: apps/participation/models.py:438 apps/participation/models.py:588
msgid "reporter"
msgstr "rapporteur"
#: apps/participation/models.py:436
#: apps/participation/models.py:443
msgid "penalties"
msgstr "pénalités"
#: apps/participation/models.py:438
#: apps/participation/models.py:445
msgid ""
"Number of penalties for the defender. The defender will loose a 0.5 "
"coefficient per penalty."
@ -366,102 +379,102 @@ msgstr ""
"Nombre de pénalités pour le défenseur. Le défenseur perd un coefficient 0.5 "
"sur sa solution écrite par pénalité."
#: apps/participation/models.py:498 apps/participation/models.py:501
#: apps/participation/models.py:504
#: apps/participation/models.py:505 apps/participation/models.py:508
#: apps/participation/models.py:511
#, python-brace-format
msgid "Team {trigram} is not registered in the pool."
msgstr "L'équipe {trigram} n'est pas inscrite dans la poule."
#: apps/participation/models.py:509
#: apps/participation/models.py:516
#, python-brace-format
msgid "Passage of {defender} for problem {problem}"
msgstr "Passage de {defender} pour le problème {problem}"
#: apps/participation/models.py:513 apps/participation/models.py:575
#: apps/participation/models.py:613
#: apps/participation/models.py:520 apps/participation/models.py:582
#: apps/participation/models.py:620
msgid "passage"
msgstr "passage"
#: apps/participation/models.py:514
#: apps/participation/models.py:521
msgid "passages"
msgstr "passages"
#: apps/participation/models.py:535
#: apps/participation/models.py:542
msgid "problem"
msgstr "numéro de problème"
#: apps/participation/models.py:542
#: apps/participation/models.py:549
msgid "solution for the final tournament"
msgstr "solution pour la finale"
#: apps/participation/models.py:547 apps/participation/models.py:586
#: apps/participation/models.py:554 apps/participation/models.py:593
msgid "file"
msgstr "fichier"
#: apps/participation/models.py:555
#: apps/participation/models.py:562
#, python-brace-format
msgid "Solution of team {team} for problem {problem}"
msgstr "Solution de l'équipe {team} pour le problème {problem}"
#: apps/participation/models.py:559
#: apps/participation/models.py:566
msgid "solution"
msgstr "solution"
#: apps/participation/models.py:560
#: apps/participation/models.py:567
msgid "solutions"
msgstr "solutions"
#: apps/participation/models.py:594
#: apps/participation/models.py:601
#, python-brace-format
msgid "Synthesis for the {type} of the {passage}"
msgstr "Synthèse de {type} du {passage}"
#: apps/participation/models.py:597
#: apps/participation/models.py:604
msgid "synthesis"
msgstr "note de synthèse"
#: apps/participation/models.py:598
#: apps/participation/models.py:605
msgid "syntheses"
msgstr "notes de synthèse"
#: apps/participation/models.py:606
#: apps/participation/models.py:613
msgid "jury"
msgstr "jury"
#: apps/participation/models.py:618
#: apps/participation/models.py:625
msgid "defender writing note"
msgstr "note d'écrit du défenseur"
#: apps/participation/models.py:624
#: apps/participation/models.py:631
msgid "defender oral note"
msgstr "note d'oral du défenseur"
#: apps/participation/models.py:630
#: apps/participation/models.py:637
msgid "opponent writing note"
msgstr "note d'écrit de l'opposant"
#: apps/participation/models.py:636
#: apps/participation/models.py:643
msgid "opponent oral note"
msgstr "note d'oral de l'opposant"
#: apps/participation/models.py:642
#: apps/participation/models.py:649
msgid "reporter writing note"
msgstr "not d'écrit du rapporteur"
#: apps/participation/models.py:648
#: apps/participation/models.py:655
msgid "reporter oral note"
msgstr "note d'oral du rapporteur"
#: apps/participation/models.py:657
#: apps/participation/models.py:664
#, python-brace-format
msgid "Notes of {jury} for {passage}"
msgstr "Notes de {jury} pour le {passage}"
#: apps/participation/models.py:664
#: apps/participation/models.py:671
msgid "note"
msgstr "note"
#: apps/participation/models.py:665
#: apps/participation/models.py:672
msgid "notes"
msgstr "notes"
@ -536,9 +549,9 @@ msgid "Join"
msgstr "Rejoindre"
#: apps/participation/templates/participation/note_form.html:11
#: apps/participation/templates/participation/passage_detail.html:47
#: apps/participation/templates/participation/passage_detail.html:103
#: apps/participation/templates/participation/passage_detail.html:108
#: apps/participation/templates/participation/passage_detail.html:49
#: apps/participation/templates/participation/passage_detail.html:105
#: apps/participation/templates/participation/passage_detail.html:111
#: apps/participation/templates/participation/pool_detail.html:55
#: apps/participation/templates/participation/pool_detail.html:73
#: apps/participation/templates/participation/pool_detail.html:78
@ -597,11 +610,11 @@ msgid "Upload solution"
msgstr "Envoyer une solution"
#: apps/participation/templates/participation/participation_detail.html:50
#: apps/participation/templates/participation/passage_detail.html:113
#: apps/participation/templates/participation/passage_detail.html:117
#: apps/participation/templates/participation/team_detail.html:172
#: apps/participation/templates/participation/upload_motivation_letter.html:13
#: apps/participation/templates/participation/upload_solution.html:11
#: apps/participation/templates/participation/upload_synthesis.html:11
#: apps/participation/templates/participation/upload_synthesis.html:16
#: apps/registration/templates/registration/upload_health_sheet.html:17
#: apps/registration/templates/registration/upload_parental_authorization.html:17
#: apps/registration/templates/registration/upload_photo_authorization.html:18
@ -648,57 +661,57 @@ msgstr "Notes de synthèse :"
msgid "No synthesis was uploaded yet."
msgstr "Aucune note de synthèse n'a encore été envoyée."
#: apps/participation/templates/participation/passage_detail.html:46
#: apps/participation/templates/participation/passage_detail.html:107
#: apps/participation/templates/participation/passage_detail.html:47
#: apps/participation/templates/participation/passage_detail.html:110
msgid "Update notes"
msgstr "Modifier les notes"
#: apps/participation/templates/participation/passage_detail.html:51
#: apps/participation/templates/participation/passage_detail.html:112
#: apps/participation/templates/participation/passage_detail.html:53
#: apps/participation/templates/participation/passage_detail.html:116
msgid "Upload synthesis"
msgstr "Envoyer une note de synthèse"
#: apps/participation/templates/participation/passage_detail.html:59
#: apps/participation/templates/participation/passage_detail.html:61
msgid "Notes detail"
msgstr "Détails des notes"
#: apps/participation/templates/participation/passage_detail.html:66
#: apps/participation/templates/participation/passage_detail.html:68
msgid "Average points for the defender writing:"
msgstr "Moyenne de l'écrit du défenseur :"
#: apps/participation/templates/participation/passage_detail.html:69
#: apps/participation/templates/participation/passage_detail.html:71
msgid "Average points for the defender oral:"
msgstr "Moyenne de l'oral du défenseur :"
#: apps/participation/templates/participation/passage_detail.html:72
#: apps/participation/templates/participation/passage_detail.html:74
msgid "Average points for the opponent writing:"
msgstr "Moyenne de l'écrit de l'opposant :"
#: apps/participation/templates/participation/passage_detail.html:75
#: apps/participation/templates/participation/passage_detail.html:77
msgid "Average points for the opponent oral:"
msgstr "Moyenne de l'oral de l'opposant :"
#: apps/participation/templates/participation/passage_detail.html:78
#: apps/participation/templates/participation/passage_detail.html:80
msgid "Average points for the reporter writing:"
msgstr "Moyenne de l'écrit du rapporteur :"
#: apps/participation/templates/participation/passage_detail.html:81
#: apps/participation/templates/participation/passage_detail.html:83
msgid "Average points for the reporter oral:"
msgstr "Moyenne de l'oral du rapporteur :"
#: apps/participation/templates/participation/passage_detail.html:88
#: apps/participation/templates/participation/passage_detail.html:90
msgid "Defender points:"
msgstr "Points du défenseur :"
#: apps/participation/templates/participation/passage_detail.html:91
#: apps/participation/templates/participation/passage_detail.html:93
msgid "Opponent points:"
msgstr "Points de l'opposant :"
#: apps/participation/templates/participation/passage_detail.html:94
#: apps/participation/templates/participation/passage_detail.html:96
msgid "Reporter points:"
msgstr "Points du rapporteur :"
#: apps/participation/templates/participation/passage_detail.html:102
#: apps/participation/templates/participation/passage_detail.html:104
#: apps/participation/templates/participation/passage_form.html:11
msgid "Update passage"
msgstr "Modifier le passage"
@ -988,6 +1001,10 @@ msgstr "Ajouter un tournoi"
msgid "Back to the team detail"
msgstr "Retour aux détails de l'utilisateur"
#: apps/participation/templates/participation/upload_synthesis.html:9
msgid "Templates:"
msgstr "Modèles :"
#: apps/participation/views.py:43 tfjm/templates/base.html:74
#: tfjm/templates/base.html:233
msgid "Create team"
@ -1094,11 +1111,11 @@ msgstr "L'équipe n'est pas encore validée."
msgid "Participation of team {trigram}"
msgstr "Participation de l'équipe {trigram}"
#: apps/participation/views.py:578
#: apps/participation/views.py:579
msgid "You can't upload a solution after the deadline."
msgstr "Vous ne pouvez pas envoyer de solution après la date limite."
#: apps/participation/views.py:759
#: apps/participation/views.py:765
msgid "You can't upload a synthesis after the deadline."
msgstr "Vous ne pouvez pas envoyer de note de synthèse après la date limite."