1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-02-23 22:21:18 +00:00

Compare commits

..

No commits in common. "4084f7abb5c6f39c48a64c111f0dc26ff617e757" and "d093414ec7e62d2200d779760a17ffd36796efe7" have entirely different histories.

6 changed files with 102 additions and 146 deletions

View File

@ -154,7 +154,7 @@ class SolutionForm(forms.ModelForm):
pages = len(pdf_reader.pages)
if pages > 30:
raise ValidationError(_("The PDF file must not have more than 30 pages."))
return self.cleaned_data["file"]
return self.cleaned_data["photo_authorization"]
def save(self, commit=True):
"""
@ -213,7 +213,7 @@ class SynthesisForm(forms.ModelForm):
raise ValidationError(_("The uploaded file size must be under 2 Mo."))
if file.content_type != "application/pdf":
raise ValidationError(_("The uploaded file must be a PDF file."))
return self.cleaned_data["file"]
return self.cleaned_data["photo_authorization"]
def save(self, commit=True):
"""

View File

@ -1,18 +0,0 @@
# Generated by Django 3.1.7 on 2021-04-03 19:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('participation', '0003_tournament_remote'),
]
operations = [
migrations.AddField(
model_name='passage',
name='defender_penalties',
field=models.PositiveSmallIntegerField(default=0, help_text='Number of penalties for the defender. The defender will loose a 0.5 coefficient per penalty.', verbose_name='penalties'),
),
]

View File

@ -432,13 +432,6 @@ class Passage(models.Model):
related_name="+",
)
defender_penalties = models.PositiveSmallIntegerField(
verbose_name=_("penalties"),
default=0,
help_text=_("Number of penalties for the defender. "
"The defender will loose a 0.5 coefficient per penalty."),
)
@property
def defended_solution(self) -> "Solution":
return Solution.objects.get(
@ -446,44 +439,44 @@ class Passage(models.Model):
problem=self.solution_number,
final_solution=self.pool.tournament.final)
def avg(self, iterator) -> float:
def avg(self, iterator) -> int:
items = [i for i in iterator if i]
return sum(items) / len(items) if items else 0
@property
def average_defender_writing(self) -> float:
def average_defender_writing(self) -> int:
return self.avg(note.defender_writing for note in self.notes.all())
@property
def average_defender_oral(self) -> float:
def average_defender_oral(self) -> int:
return self.avg(note.defender_oral for note in self.notes.all())
@property
def average_defender(self) -> float:
return self.average_defender_writing + (2 - 0.5 * self.defender_penalties) * self.average_defender_oral
def average_defender(self) -> int:
return self.average_defender_writing + 2 * self.average_defender_oral
@property
def average_opponent_writing(self) -> float:
def average_opponent_writing(self) -> int:
return self.avg(note.opponent_writing for note in self.notes.all())
@property
def average_opponent_oral(self) -> float:
def average_opponent_oral(self) -> int:
return self.avg(note.opponent_oral for note in self.notes.all())
@property
def average_opponent(self) -> float:
def average_opponent(self) -> int:
return self.average_opponent_writing + 2 * self.average_opponent_oral
@property
def average_reporter_writing(self) -> float:
def average_reporter_writing(self) -> int:
return self.avg(note.reporter_writing for note in self.notes.all())
@property
def average_reporter_oral(self) -> float:
def average_reporter_oral(self) -> int:
return self.avg(note.reporter_oral for note in self.notes.all())
@property
def average_reporter(self) -> float:
def average_reporter(self) -> int:
return self.average_reporter_writing + self.average_reporter_oral
def average(self, participation):

View File

@ -28,9 +28,6 @@
<dt class="col-sm-3">{% trans "Place:" %}</dt>
<dd class="col-sm-9">{{ passage.place }}</dd>
<dt class="col-sm-3">{% trans "Defender penalties count:" %}</dt>
<dd class="col-sm-9">{{ passage.defender_penalties }}</dd>
<dt class="col-sm-3">{% trans "Syntheses:" %}</dt>
<dd class="col-sm-9">
{% for synthesis in passage.syntheses.all %}

View File

@ -573,7 +573,7 @@ class SolutionUploadView(LoginRequiredMixin, FormView):
problem=form_sol.problem,
final_solution=self.participation.final)
tournament = Tournament.final_tournament() if self.participation.final else self.participation.tournament
tournament = Tournament.final_tournament() if self.participation.final else self.participation.final
if timezone.now() > tournament.solution_limit and sol_qs.exists():
form.add_error(None, _("You can't upload a solution after the deadline."))
return self.form_invalid(form)

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-03-15 10:16+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"
@ -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:523
#: apps/participation/models.py:561
msgid "participation"
msgstr "participation"
@ -337,7 +337,7 @@ msgstr "Où est-ce que les solutions sont défendues ?"
msgid "defended solution"
msgstr "solution défendue"
#: apps/participation/models.py:410 apps/participation/models.py:537
#: apps/participation/models.py:410 apps/participation/models.py:530
#, python-brace-format
msgid "Problem #{problem}"
msgstr "Problème n°{problem}"
@ -346,122 +346,110 @@ msgstr "Problème n°{problem}"
msgid "defender"
msgstr "défenseur"
#: apps/participation/models.py:424 apps/participation/models.py:580
#: apps/participation/models.py:424 apps/participation/models.py:573
msgid "opponent"
msgstr "opposant"
#: apps/participation/models.py:431 apps/participation/models.py:581
#: apps/participation/models.py:431 apps/participation/models.py:574
msgid "reporter"
msgstr "rapporteur"
#: apps/participation/models.py:436
msgid "penalties"
msgstr "pénalités"
#: apps/participation/models.py:438
msgid ""
"Number of penalties for the defender. The defender will loose a 0.5 "
"coefficient per penalty."
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:491 apps/participation/models.py:494
#: apps/participation/models.py:497
#, 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:502
#, 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:506 apps/participation/models.py:568
#: apps/participation/models.py:606
msgid "passage"
msgstr "passage"
#: apps/participation/models.py:514
#: apps/participation/models.py:507
msgid "passages"
msgstr "passages"
#: apps/participation/models.py:535
#: apps/participation/models.py:528
msgid "problem"
msgstr "numéro de problème"
#: apps/participation/models.py:542
#: apps/participation/models.py:535
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:540 apps/participation/models.py:579
msgid "file"
msgstr "fichier"
#: apps/participation/models.py:555
#: apps/participation/models.py:548
#, 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:552
msgid "solution"
msgstr "solution"
#: apps/participation/models.py:560
#: apps/participation/models.py:553
msgid "solutions"
msgstr "solutions"
#: apps/participation/models.py:594
#: apps/participation/models.py:587
#, python-brace-format
msgid "Synthesis for the {type} of the {passage}"
msgstr "Synthèse pour {type} du {passage}"
#: apps/participation/models.py:597
#: apps/participation/models.py:590
msgid "synthesis"
msgstr "note de synthèse"
#: apps/participation/models.py:598
#: apps/participation/models.py:591
msgid "syntheses"
msgstr "notes de synthèse"
#: apps/participation/models.py:606
#: apps/participation/models.py:599
msgid "jury"
msgstr "jury"
#: apps/participation/models.py:618
#: apps/participation/models.py:611
msgid "defender writing note"
msgstr "note d'écrit du défenseur"
#: apps/participation/models.py:624
#: apps/participation/models.py:617
msgid "defender oral note"
msgstr "note d'oral du défenseur"
#: apps/participation/models.py:630
#: apps/participation/models.py:623
msgid "opponent writing note"
msgstr "note d'écrit de l'opposant"
#: apps/participation/models.py:636
#: apps/participation/models.py:629
msgid "opponent oral note"
msgstr "note d'oral de l'opposant"
#: apps/participation/models.py:642
#: apps/participation/models.py:635
msgid "reporter writing note"
msgstr "not d'écrit du rapporteur"
#: apps/participation/models.py:648
#: apps/participation/models.py:641
msgid "reporter oral note"
msgstr "note d'oral du rapporteur"
#: apps/participation/models.py:657
#: apps/participation/models.py:650
#, 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:657
msgid "note"
msgstr "note"
#: apps/participation/models.py:665
#: apps/participation/models.py:658
msgid "notes"
msgstr "notes"
@ -536,14 +524,14 @@ 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:44
#: apps/participation/templates/participation/passage_detail.html:100
#: apps/participation/templates/participation/passage_detail.html:105
#: apps/participation/templates/participation/pool_detail.html:55
#: apps/participation/templates/participation/pool_detail.html:73
#: apps/participation/templates/participation/pool_detail.html:78
#: apps/participation/templates/participation/team_detail.html:113
#: apps/participation/templates/participation/team_detail.html:177
#: apps/participation/templates/participation/team_detail.html:111
#: apps/participation/templates/participation/team_detail.html:175
#: apps/participation/templates/participation/tournament_form.html:12
#: apps/participation/templates/participation/update_team.html:12
#: apps/registration/templates/registration/payment_form.html:49
@ -597,8 +585,8 @@ 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/team_detail.html:172
#: apps/participation/templates/participation/passage_detail.html:110
#: apps/participation/templates/participation/team_detail.html:170
#: 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
@ -637,68 +625,64 @@ msgid "Place:"
msgstr "Lieu :"
#: apps/participation/templates/participation/passage_detail.html:31
msgid "Defender penalties count:"
msgstr "Nombre de pénalités :"
#: apps/participation/templates/participation/passage_detail.html:34
msgid "Syntheses:"
msgstr "Notes de synthèse :"
#: apps/participation/templates/participation/passage_detail.html:39
#: apps/participation/templates/participation/passage_detail.html:36
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:43
#: apps/participation/templates/participation/passage_detail.html:104
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:48
#: apps/participation/templates/participation/passage_detail.html:109
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:56
msgid "Notes detail"
msgstr "Détails des notes"
#: apps/participation/templates/participation/passage_detail.html:66
#: apps/participation/templates/participation/passage_detail.html:63
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:66
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:69
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:72
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:75
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:78
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:85
msgid "Defender points:"
msgstr "Points du défenseur :"
#: apps/participation/templates/participation/passage_detail.html:91
#: apps/participation/templates/participation/passage_detail.html:88
msgid "Opponent points:"
msgstr "Points de l'opposant :"
#: apps/participation/templates/participation/passage_detail.html:94
#: apps/participation/templates/participation/passage_detail.html:91
msgid "Reporter points:"
msgstr "Points du rapporteur :"
#: apps/participation/templates/participation/passage_detail.html:102
#: apps/participation/templates/participation/passage_detail.html:99
#: apps/participation/templates/participation/passage_form.html:11
msgid "Update passage"
msgstr "Modifier le passage"
@ -816,21 +800,21 @@ msgstr "Télécharger"
msgid "Replace"
msgstr "Remplacer"
#: apps/participation/templates/participation/team_detail.html:107
#: apps/participation/templates/participation/team_detail.html:106
msgid "Download all submitted authorizations"
msgstr "Télécharger toutes les autorisations soumises"
#: apps/participation/templates/participation/team_detail.html:115
#: apps/participation/templates/participation/team_detail.html:182
#: apps/participation/templates/participation/team_detail.html:113
#: apps/participation/templates/participation/team_detail.html:180
#: apps/participation/templates/participation/team_leave.html:11
msgid "Leave"
msgstr "Quitter"
#: apps/participation/templates/participation/team_detail.html:125
#: apps/participation/templates/participation/team_detail.html:123
msgid "Access to team participation"
msgstr "Accéder à la participation de l'équipe"
#: apps/participation/templates/participation/team_detail.html:132
#: apps/participation/templates/participation/team_detail.html:130
msgid ""
"Your team has at least 4 members and a coach and all authorizations were "
"given: the team can be validated."
@ -838,11 +822,11 @@ msgstr ""
"Votre équipe contient au moins 4 personnes et un encadrant et toutes les "
"autorisations ont été données : l'équipe peut être validée."
#: apps/participation/templates/participation/team_detail.html:137
#: apps/participation/templates/participation/team_detail.html:135
msgid "Submit my team to validation"
msgstr "Soumettre mon équipe à validation"
#: apps/participation/templates/participation/team_detail.html:143
#: apps/participation/templates/participation/team_detail.html:141
msgid ""
"Your team must be composed of 4 members and a coach and each member must "
"upload their authorizations and confirm its email address."
@ -850,15 +834,15 @@ msgstr ""
"Votre équipe doit être composée d'au moins 4 membres et un encadrant et "
"chaque membre doit envoyer ses autorisations et confirmé son adresse e-mail."
#: apps/participation/templates/participation/team_detail.html:148
#: apps/participation/templates/participation/team_detail.html:146
msgid "This team didn't ask for validation yet."
msgstr "L'équipe n'a pas encore demandé à être validée."
#: apps/participation/templates/participation/team_detail.html:154
#: apps/participation/templates/participation/team_detail.html:152
msgid "Your validation is pending."
msgstr "Votre validation est en attente."
#: apps/participation/templates/participation/team_detail.html:158
#: apps/participation/templates/participation/team_detail.html:156
msgid ""
"The team requested to be validated. You may now control the authorizations "
"and confirm that they can participate."
@ -866,25 +850,25 @@ msgstr ""
"L'équipe a demandé à être validée. Vous pouvez désormais contrôler les "
"différentes autorisations et confirmer qu'elle peut participer."
#: apps/participation/templates/participation/team_detail.html:164
#: apps/participation/templates/participation/team_detail.html:162
msgid "Validate"
msgstr "Valider"
#: apps/participation/templates/participation/team_detail.html:165
#: apps/participation/templates/participation/team_detail.html:163
msgid "Invalidate"
msgstr "Invalider"
#: apps/participation/templates/participation/team_detail.html:171
#: apps/participation/templates/participation/team_detail.html:169
#: apps/participation/views.py:323
msgid "Upload motivation letter"
msgstr "Envoyer la lettre de motivation"
#: apps/participation/templates/participation/team_detail.html:176
#: apps/participation/templates/participation/team_detail.html:174
msgid "Update team"
msgstr "Modifier l'équipe"
#: apps/participation/templates/participation/team_detail.html:181
#: apps/participation/views.py:423
#: apps/participation/templates/participation/team_detail.html:179
#: apps/participation/views.py:424
msgid "Leave team"
msgstr "Quitter l'équipe"
@ -1006,12 +990,12 @@ msgstr "Vous êtes déjà dans une équipe."
msgid "Join team"
msgstr "Rejoindre une équipe"
#: apps/participation/views.py:150 apps/participation/views.py:429
#: apps/participation/views.py:462
#: apps/participation/views.py:150 apps/participation/views.py:430
#: apps/participation/views.py:463
msgid "You are not in a team."
msgstr "Vous n'êtes pas dans une équipe."
#: apps/participation/views.py:151 apps/participation/views.py:463
#: apps/participation/views.py:151 apps/participation/views.py:464
msgid "You don't participate, so you don't have any team."
msgstr "Vous ne participez pas, vous n'avez donc pas d'équipe."
@ -1056,49 +1040,49 @@ msgstr "Vous devez spécifier si vous validez l'inscription ou non."
msgid "Update team {trigram}"
msgstr "Mise à jour de l'équipe {trigram}"
#: apps/participation/views.py:361 apps/participation/views.py:409
#: apps/participation/views.py:361 apps/participation/views.py:410
#, python-brace-format
msgid "Motivation letter of {team}.{ext}"
msgstr "Lettre de motivation de {team}.{ext}"
#: apps/participation/views.py:390
#: apps/participation/views.py:391
#, python-brace-format
msgid "Photo authorization of {participant}.{ext}"
msgstr "Autorisation de droit à l'image de {participant}.{ext}"
#: apps/participation/views.py:396
#: apps/participation/views.py:397
#, python-brace-format
msgid "Parental authorization of {participant}.{ext}"
msgstr "Autorisation parentale de {participant}.{ext}"
#: apps/participation/views.py:403
#: apps/participation/views.py:404
#, python-brace-format
msgid "Health sheet of {participant}.{ext}"
msgstr "Fiche sanitaire de {participant}.{ext}"
#: apps/participation/views.py:413
#: apps/participation/views.py:414
#, python-brace-format
msgid "Photo authorizations of team {trigram}.zip"
msgstr "Autorisations de droit à l'image de l'équipe {trigram}.zip"
#: apps/participation/views.py:431
#: apps/participation/views.py:432
msgid "The team is already validated or the validation is pending."
msgstr "La validation de l'équipe est déjà faite ou en cours."
#: apps/participation/views.py:477
#: apps/participation/views.py:478
msgid "The team is not validated yet."
msgstr "L'équipe n'est pas encore validée."
#: apps/participation/views.py:489
#: apps/participation/views.py:490
#, python-brace-format
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:760
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."
@ -1506,11 +1490,11 @@ msgid ""
msgstr ""
"Vous pouvez payer par carte bancaire sur <a class=\"alert-link\" href="
"\"https://www.helloasso.com/associations/animath/evenements/"
"tfjm-2021\">notre page Hello Asso</a>. Pour rendre la validation du paiement "
"plus facile, <span class=\"text-danger\">merci d'utiliser la même adresse e-"
"mail que vous utilisez sur cette plateforme.</span> La vérification du "
"paiement sera faite automatiquement sous 10 minutes, vous n'avez pas "
"nécessairement besoin de remplir ce formulaire."
"tfjm-2021\">notre page Hello Asso</a>. Pour rendre la validation du "
"paiement plus facile, <span class=\"text-danger\">merci d'utiliser la même "
"adresse e-mail que vous utilisez sur cette plateforme.</span> La "
"vérification du paiement sera faite automatiquement sous 10 minutes, vous "
"n'avez pas nécessairement besoin de remplir ce formulaire."
#: apps/registration/templates/registration/payment_form.html:27
msgid ""