Teams can't see problems for the second round until the given date

This commit is contained in:
Yohann D'ANELLO 2020-05-05 18:29:02 +02:00
parent 28abf730a2
commit 4ce767d451
4 changed files with 116 additions and 98 deletions

View File

@ -38,6 +38,8 @@ class TournamentForm(forms.ModelForm):
"date_inscription": DateTimePickerInput(),
"date_solutions": DateTimePickerInput(),
"date_syntheses": DateTimePickerInput(),
"date_solutions_2": DateTimePickerInput(),
"date_syntheses_2": DateTimePickerInput(),
}

View File

@ -456,6 +456,9 @@ class PoolDetailView(LoginRequiredMixin, DetailView):
pool = self.get_object()
if "solutions_zip" in request.POST:
if user.participates and pool.round == 2 and pool.tournament.date_solutions_2 > timezone.now():
raise PermissionDenied
out = BytesIO()
zf = zipfile.ZipFile(out, "w")
@ -469,6 +472,9 @@ class PoolDetailView(LoginRequiredMixin, DetailView):
.format(_("Solutions of a pool.zip").replace(" ", "%20"))
return resp
elif "syntheses_zip" in request.POST and user.organizes:
if user.participates and pool.round == 2 and pool.tournament.date_solutions_2 > timezone.now():
raise PermissionDenied
out = BytesIO()
zf = zipfile.ZipFile(out, "w")

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: TFJM2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-05 06:09+0200\n"
"POT-Creation-Date: 2020-05-05 18:27+0200\n"
"PO-Revision-Date: 2020-04-29 02:30+0000\n"
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
"Language-Team: fr <LL@li.org>\n"
@ -43,8 +43,8 @@ msgid "email"
msgstr "Adresse électronique"
#: apps/member/models.py:26 apps/member/models.py:218 apps/member/models.py:234
#: apps/member/models.py:265 apps/tournament/models.py:196
#: apps/tournament/models.py:261 templates/member/tfjmuser_detail.html:16
#: apps/member/models.py:265 apps/tournament/models.py:217
#: apps/tournament/models.py:291 templates/member/tfjmuser_detail.html:16
msgid "team"
msgstr "équipe"
@ -116,7 +116,7 @@ msgstr "téléphone du responsable"
msgid "responsible email"
msgstr "email du responsable"
#: apps/member/models.py:124 apps/tournament/models.py:35
#: apps/member/models.py:124 apps/tournament/models.py:37
#: templates/member/tfjmuser_detail.html:67
#: templates/tournament/tournament_detail.html:36
msgid "description"
@ -134,13 +134,13 @@ msgstr "Organisateur"
msgid "Coach"
msgstr "Encadrant"
#: apps/member/models.py:139 apps/tournament/models.py:79
#: apps/tournament/models.py:157
#: apps/member/models.py:139 apps/tournament/models.py:81
#: apps/tournament/models.py:178
msgid "year"
msgstr "année"
#: apps/member/models.py:155 apps/member/models.py:191
#: apps/tournament/models.py:254
#: apps/tournament/models.py:284
msgid "user"
msgstr "utilisateur"
@ -176,7 +176,7 @@ msgstr "Autorisation de droit à l'image"
msgid "Sanitary plug"
msgstr "Fiche sanitaire"
#: apps/member/models.py:200 apps/tournament/models.py:272
#: apps/member/models.py:200 apps/tournament/models.py:302
msgid "Scholarship"
msgstr "Bourse"
@ -222,7 +222,7 @@ msgstr "solution pour la finale"
msgid "solution"
msgstr "solution"
#: apps/member/models.py:252 apps/tournament/models.py:214
#: apps/member/models.py:252 apps/tournament/models.py:244
msgid "solutions"
msgstr "solutions"
@ -247,15 +247,15 @@ msgstr "Rapporteur"
msgid "source"
msgstr "source"
#: apps/member/models.py:280 apps/tournament/models.py:219
#: apps/member/models.py:280 apps/tournament/models.py:249
msgid "Round 1"
msgstr "Tour 1"
#: apps/member/models.py:281 apps/tournament/models.py:220
#: apps/member/models.py:281 apps/tournament/models.py:250
msgid "Round 2"
msgstr "Tour 2"
#: apps/member/models.py:283 apps/tournament/models.py:222
#: apps/member/models.py:283 apps/tournament/models.py:252
#: templates/tournament/pool_detail.html:18
msgid "round"
msgstr "tour"
@ -323,8 +323,8 @@ msgstr "Profils orphelins"
msgid "Organizers"
msgstr "Organisateurs"
#: apps/tournament/apps.py:7 apps/tournament/models.py:104
#: apps/tournament/models.py:126 templates/tournament/pool_detail.html:21
#: apps/tournament/apps.py:7 apps/tournament/models.py:110
#: apps/tournament/models.py:147 templates/tournament/pool_detail.html:21
#: templates/tournament/team_detail.html:21
msgid "tournament"
msgstr "tournoi"
@ -337,220 +337,220 @@ msgstr "Ce tournoi existe déjà."
msgid "The final tournament was already defined."
msgstr "Le tournoi de la finale est déjà défini."
#: apps/tournament/forms.py:53
#: apps/tournament/forms.py:55
msgid "This organizer already exist."
msgstr "Cet organisateur existe déjà."
#: apps/tournament/forms.py:78
#: apps/tournament/forms.py:81
msgid "The trigram must be composed of three upcase letters."
msgstr "Le trigramme doit être composé de trois lettres en majuscules."
#: apps/tournament/forms.py:82
#: apps/tournament/forms.py:85
msgid "This trigram is already used."
msgstr "Ce trigramme est déjà utilisé."
#: apps/tournament/forms.py:85
#: apps/tournament/forms.py:88
msgid "This name is already used."
msgstr "Ce nom est déjà utilisé."
#: apps/tournament/forms.py:88
#: apps/tournament/forms.py:91
msgid "This tournament is already closed."
msgstr "Ce tournoi est déjà fermé."
#: apps/tournament/forms.py:95
#: apps/tournament/forms.py:98
msgid "Access code"
msgstr "Code d'accès"
#: apps/tournament/forms.py:103
#: apps/tournament/forms.py:106
msgid "The access code must be composed of 6 alphanumeric characters."
msgstr "Le code d'accès doit être composé de 6 caractères alphanumériques."
#: apps/tournament/forms.py:107
#: apps/tournament/forms.py:110
msgid "This access code is invalid."
msgstr "Ce code d'accès est invalide."
#: apps/tournament/forms.py:110
#: apps/tournament/forms.py:113
msgid "The team is already validated."
msgstr "L'équipe est déjà validée."
#: apps/tournament/forms.py:118
#: apps/tournament/forms.py:121
msgid "Problem"
msgstr "Problème"
#: apps/tournament/forms.py:119
#: apps/tournament/forms.py:122
#, python-brace-format
msgid "Problem #{problem:d}"
msgstr "Problème n°{problem:d}"
#: apps/tournament/forms.py:136 apps/tournament/forms.py:149
#: apps/tournament/forms.py:162
#: apps/tournament/forms.py:139 apps/tournament/forms.py:152
#: apps/tournament/forms.py:165
msgid "Choose a team..."
msgstr "Choisir une équipe ..."
#: apps/tournament/forms.py:137
#: apps/tournament/forms.py:140
msgid "Team 1"
msgstr "Équipe 1"
#: apps/tournament/forms.py:144
#: apps/tournament/forms.py:147
msgid "Problem defended by team 1"
msgstr "Problème défendu par l'équipe 1"
#: apps/tournament/forms.py:150
#: apps/tournament/forms.py:153
msgid "Team 2"
msgstr "Équipe 2"
#: apps/tournament/forms.py:157
#: apps/tournament/forms.py:160
msgid "Problem defended by team 2"
msgstr "Problème défendu par l'équipe 2"
#: apps/tournament/forms.py:163
#: apps/tournament/forms.py:166
msgid "Team 3"
msgstr "Équipe 3"
#: apps/tournament/forms.py:170
#: apps/tournament/forms.py:173
msgid "Problem defended by team 3"
msgstr "Problème défendu par l'équipe 3"
#: apps/tournament/models.py:12 apps/tournament/models.py:114
#: apps/tournament/models.py:14 apps/tournament/models.py:135
#: templates/tournament/team_detail.html:12
msgid "name"
msgstr "nom"
#: apps/tournament/models.py:18 templates/tournament/tournament_detail.html:12
#: apps/tournament/models.py:20 templates/tournament/tournament_detail.html:12
msgid "organizers"
msgstr "organisateurs"
#: apps/tournament/models.py:22 templates/tournament/tournament_detail.html:15
#: apps/tournament/models.py:24 templates/tournament/tournament_detail.html:15
msgid "size"
msgstr "taille"
#: apps/tournament/models.py:27 templates/tournament/tournament_detail.html:18
#: apps/tournament/models.py:29 templates/tournament/tournament_detail.html:18
msgid "place"
msgstr "lieu"
#: apps/tournament/models.py:31 templates/tournament/tournament_detail.html:21
#: apps/tournament/models.py:33 templates/tournament/tournament_detail.html:21
msgid "price"
msgstr "prix"
#: apps/tournament/models.py:40
#: apps/tournament/models.py:42
msgid "date start"
msgstr "date de début"
#: apps/tournament/models.py:45
#: apps/tournament/models.py:47
msgid "date end"
msgstr "date de fin"
#: apps/tournament/models.py:50 templates/tournament/tournament_detail.html:27
#: apps/tournament/models.py:52 templates/tournament/tournament_detail.html:27
msgid "date of registration closing"
msgstr "date de clôture des inscriptions"
#: apps/tournament/models.py:55 templates/tournament/tournament_detail.html:30
#: apps/tournament/models.py:57 templates/tournament/tournament_detail.html:30
msgid "date of maximal solution submission"
msgstr "date d'envoi maximal des solutions"
#: apps/tournament/models.py:60
#: apps/tournament/models.py:62
msgid "date of maximal syntheses submission for the first round"
msgstr "date d'envoi maximal des notes de synthèses du premier tour"
#: apps/tournament/models.py:65
#: apps/tournament/models.py:67
msgid "date when solutions of round 2 are available"
msgstr "date à partir de laquelle les solutions du tour 2 sont disponibles"
#: apps/tournament/models.py:70
#: apps/tournament/models.py:72
msgid "date of maximal syntheses submission for the second round"
msgstr "date d'envoi maximal des notes de synthèses pour le second tour"
#: apps/tournament/models.py:74
#: apps/tournament/models.py:76
msgid "final tournament"
msgstr "finale"
#: apps/tournament/models.py:105
#: apps/tournament/models.py:111
msgid "tournaments"
msgstr "tournois"
#: apps/tournament/models.py:119 templates/tournament/team_detail.html:15
#: apps/tournament/models.py:140 templates/tournament/team_detail.html:15
msgid "trigram"
msgstr "trigramme"
#: apps/tournament/models.py:131
#: apps/tournament/models.py:152
msgid "inscription date"
msgstr "date d'inscription"
#: apps/tournament/models.py:137 apps/tournament/models.py:281
#: apps/tournament/models.py:158 apps/tournament/models.py:311
msgid "Registration not validated"
msgstr "Inscription non validée"
#: apps/tournament/models.py:138 apps/tournament/models.py:282
#: apps/tournament/models.py:159 apps/tournament/models.py:312
msgid "Waiting for validation"
msgstr "En attente de validation"
#: apps/tournament/models.py:139 apps/tournament/models.py:283
#: apps/tournament/models.py:160 apps/tournament/models.py:313
msgid "Registration validated"
msgstr "Inscription validée"
#: apps/tournament/models.py:141 apps/tournament/models.py:285
#: apps/tournament/models.py:162 apps/tournament/models.py:315
#: templates/tournament/team_detail.html:30
msgid "validation status"
msgstr "statut de validation"
#: apps/tournament/models.py:146
#: apps/tournament/models.py:167
msgid "selected for final"
msgstr "sélectionnée pour la finale"
#: apps/tournament/models.py:152 templates/tournament/team_detail.html:18
#: apps/tournament/models.py:173 templates/tournament/team_detail.html:18
msgid "access code"
msgstr "code d'accès"
#: apps/tournament/models.py:197 apps/tournament/models.py:208
#: apps/tournament/models.py:218 apps/tournament/models.py:238
#: templates/tournament/pool_detail.html:15
msgid "teams"
msgstr "équipes"
#: apps/tournament/models.py:228 templates/tournament/pool_detail.html:12
#: apps/tournament/models.py:258 templates/tournament/pool_detail.html:12
msgid "juries"
msgstr "jurys"
#: apps/tournament/models.py:245
#: apps/tournament/models.py:275
msgid "pool"
msgstr "poule"
#: apps/tournament/models.py:246
#: apps/tournament/models.py:276
msgid "pools"
msgstr "poules"
#: apps/tournament/models.py:267
#: apps/tournament/models.py:297
msgid "Not paid"
msgstr "Non payé"
#: apps/tournament/models.py:268
#: apps/tournament/models.py:298
msgid "Credit card"
msgstr "Carte bancaire"
#: apps/tournament/models.py:269
#: apps/tournament/models.py:299
msgid "Bank check"
msgstr "Chèque bancaire"
#: apps/tournament/models.py:270
#: apps/tournament/models.py:300
msgid "Bank transfer"
msgstr "Virement bancaire"
#: apps/tournament/models.py:271
#: apps/tournament/models.py:301
msgid "Cash"
msgstr "Espèces"
#: apps/tournament/models.py:275
#: apps/tournament/models.py:305
msgid "payment method"
msgstr "moyen de paiement"
#: apps/tournament/models.py:289
#: apps/tournament/models.py:319
msgid "payment"
msgstr "paiement"
#: apps/tournament/models.py:290
#: apps/tournament/models.py:320
msgid "payments"
msgstr "paiements"
#: apps/tournament/models.py:293
#: apps/tournament/models.py:323
#, python-brace-format
msgid "Payment of {user}"
msgstr "Paiement de {user}"
@ -563,77 +563,77 @@ msgstr "dates"
msgid "From {start:%b %d %Y} to {end:%b %d %Y}"
msgstr "Du {start: %d %b %Y} au {end:%d %b %Y}"
#: apps/tournament/tables.py:68 apps/tournament/tables.py:101
#: apps/tournament/tables.py:70 apps/tournament/tables.py:103
#: templates/tournament/team_detail.html:115
#: templates/tournament/team_detail.html:123
msgid "Download"
msgstr "Télécharger"
#: apps/tournament/views.py:52
#: apps/tournament/views.py:49
msgid "Tournaments list"
msgstr "Liste des tournois"
#: apps/tournament/views.py:71
#: apps/tournament/views.py:68
msgid "Add tournament"
msgstr "Ajouter un tournoi"
#: apps/tournament/views.py:83
#: apps/tournament/views.py:80
#, python-brace-format
msgid "Tournament of {name}"
msgstr "Tournoi de {name}"
#: apps/tournament/views.py:104
#: apps/tournament/views.py:101
msgid "Update tournament"
msgstr "Modifier le tournoi"
#: apps/tournament/views.py:136 apps/tournament/views.py:223
#: apps/tournament/views.py:133 apps/tournament/views.py:221
#, python-brace-format
msgid "Solutions for team {team}.zip"
msgstr "Solutions pour l'équipe {team}.zip"
#: apps/tournament/views.py:169
#: apps/tournament/views.py:166
msgid "Information about team"
msgstr "Informations sur l'équipe"
#: apps/tournament/views.py:177
#: apps/tournament/views.py:174
msgid "Update team"
msgstr "Modifier l'équipe"
#: apps/tournament/views.py:189
#: apps/tournament/views.py:186
msgid "Add organizer"
msgstr "Ajouter un organisateur"
#: apps/tournament/views.py:207 templates/base.html:108 templates/base.html:126
#: apps/tournament/views.py:205 templates/base.html:108 templates/base.html:126
#: templates/tournament/pool_detail.html:31
msgid "Solutions"
msgstr "Solutions"
#: apps/tournament/views.py:241
#: apps/tournament/views.py:239
msgid ""
"You can't publish your solution anymore. Deadline: {date:%m-%d-%Y %h:%M}."
msgstr ""
"Vous ne pouvez plus publier vos solutions. Deadline : {date:%d/%m/%Y %h:%M}."
#: apps/tournament/views.py:265
#: apps/tournament/views.py:263
msgid "All solutions"
msgstr "Toutes les solutions"
#: apps/tournament/views.py:284
#: apps/tournament/views.py:282
#, python-brace-format
msgid "Solutions for tournament {tournament}.zip"
msgstr "Solutions pour le tournoi {tournament}.zip"
#: apps/tournament/views.py:310 templates/base.html:111 templates/base.html:129
#: templates/tournament/pool_detail.html:53
#: apps/tournament/views.py:308 templates/base.html:111 templates/base.html:129
#: templates/tournament/pool_detail.html:59
msgid "Syntheses"
msgstr "Synthèses"
#: apps/tournament/views.py:326
#: apps/tournament/views.py:324
#, python-brace-format
msgid "Syntheses for team {team}.zip"
msgstr "Notes de synthèse de l'équipe {team}.zip"
#: apps/tournament/views.py:345
#: apps/tournament/views.py:343
msgid ""
"You can't publish your synthesis anymore for the first round. Deadline: "
"{date:%m-%d-%Y %h:%M}."
@ -641,7 +641,7 @@ msgstr ""
"Vous ne pouvez plus envoyer vos notes de synthèse pour le premier tour. "
"Deadline : {date:%d/%m/%Y %h:%M}."
#: apps/tournament/views.py:351
#: apps/tournament/views.py:349
msgid ""
"You can't publish your synthesis anymore for the second round. Deadline: "
"{date:%m-%d-%Y %h:%M}."
@ -649,32 +649,32 @@ msgstr ""
"Vous ne pouvez plus envoyer vos notes de synthèse pour le second tour. "
"Deadline : {date:%d/%m/%Y %h:%M}."
#: apps/tournament/views.py:377
#: apps/tournament/views.py:375
msgid "All syntheses"
msgstr "Toutes les notes de synthèses"
#: apps/tournament/views.py:396
#: apps/tournament/views.py:394
#, python-brace-format
msgid "Syntheses for tournament {tournament}.zip"
msgstr "Notes de synthèse pour le tournoi {tournament}.zip"
#: apps/tournament/views.py:421 templates/base.html:133
#: apps/tournament/views.py:419 templates/base.html:133
msgid "Pools"
msgstr "Poules"
#: apps/tournament/views.py:436
#: apps/tournament/views.py:435
msgid "Create pool"
msgstr "Créer une poule"
#: apps/tournament/views.py:444
#: apps/tournament/views.py:443
msgid "Pool detail"
msgstr "Détails d'une poule"
#: apps/tournament/views.py:470
#: apps/tournament/views.py:472
msgid "Solutions of a pool.zip"
msgstr "Solutions d'une poule.zip"
#: apps/tournament/views.py:483
#: apps/tournament/views.py:488
msgid "Syntheses of a pool.zip"
msgstr "Notes de synthèse d'une poule.zip"
@ -972,12 +972,16 @@ msgstr ""
msgid "Reset my password"
msgstr "Réinitialiser mon mot de passe"
#: templates/tournament/pool_detail.html:43
#: templates/tournament/pool_detail.html:65
#: templates/tournament/pool_detail.html:36
msgid "Solutions will be available here for teams from:"
msgstr "Les solutions seront disponibles ici pour les équipes à partir du :"
#: templates/tournament/pool_detail.html:49
#: templates/tournament/pool_detail.html:71
msgid "Download ZIP archive"
msgstr "Télécharger l'archive ZIP"
#: templates/tournament/pool_detail.html:74
#: templates/tournament/pool_detail.html:80
msgid "Pool list"
msgstr "Liste des poules"
@ -1084,10 +1088,10 @@ msgstr "Envoyer un mail à toutes les personnes dans une équipe"
msgid "Send a mail to all people that are in a valid team"
msgstr "Envoyer un mail à toutes les personnes dans une équipe validée"
#: tfjm/settings.py:157
#: tfjm/settings.py:146
msgid "English"
msgstr "Anglais"
#: tfjm/settings.py:158
#: tfjm/settings.py:147
msgid "French"
msgstr "Français"

View File

@ -31,6 +31,12 @@
<h4>{% trans "Solutions" %}</h4>
</div>
<div class="card-body">
{% if pool.round == 2 %}
<div class="alert alert-warning">
{% trans "Solutions will be available here for teams from:" %} {{ pool.tournament.date_solutions_2 }}
</div>
{% endif %}
<ul>
{% for solution in pool.solutions.all %}
<li><a data-turbolinks="false" href="{{ solution.file.url }}">{{ solution }}</a></li>