diff --git a/draw/models.py b/draw/models.py index b15c859..836f8be 100644 --- a/draw/models.py +++ b/draw/models.py @@ -375,10 +375,11 @@ class Pool(models.Model): [4, 1, 2], ] - for line in table: + for i, line in enumerate(table): # Create the passage await Passage.objects.acreate( pool=self.associated_pool, + position=i + 1, solution_number=tds[line[0]].accepted, defender=tds[line[0]].participation, opponent=tds[line[1]].participation, diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 73392cf..ae9c03c 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: TFJM\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-06 23:57+0200\n" +"POT-Creation-Date: 2023-04-07 00:04+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Emmy D'Anello \n" "Language-Team: LANGUAGE \n" @@ -33,7 +33,7 @@ msgstr "équipes" msgid "tournament" msgstr "tournoi" -#: draw/admin.py:60 draw/models.py:228 draw/models.py:414 +#: draw/admin.py:60 draw/models.py:228 draw/models.py:415 #: participation/models.py:355 msgid "round" msgstr "tour" @@ -201,78 +201,78 @@ msgstr "poule associée" msgid "The full pool instance." msgstr "L'instance complète de la poule." -#: draw/models.py:392 +#: draw/models.py:393 #, python-brace-format msgid "Pool {letter}{number}" msgstr "Poule {letter}{number}" -#: draw/models.py:395 draw/models.py:422 participation/admin.py:69 +#: draw/models.py:396 draw/models.py:423 participation/admin.py:69 #: participation/admin.py:88 participation/models.py:421 #: participation/models.py:430 participation/tables.py:82 msgid "pool" msgstr "poule" -#: draw/models.py:396 participation/models.py:422 +#: draw/models.py:397 participation/models.py:422 msgid "pools" msgstr "poules" -#: draw/models.py:408 participation/models.py:342 participation/models.py:554 -#: participation/models.py:584 participation/models.py:622 +#: draw/models.py:409 participation/models.py:342 participation/models.py:562 +#: participation/models.py:592 participation/models.py:630 msgid "participation" msgstr "participation" -#: draw/models.py:429 +#: draw/models.py:430 msgid "passage index" msgstr "numéro de passage" -#: draw/models.py:430 +#: draw/models.py:431 msgid "" "The passage order in the pool, between 0 and the size of the pool minus 1." msgstr "" "L'ordre de passage dans la poule, de 0 à la taille de la poule moins 1." -#: draw/models.py:438 +#: draw/models.py:439 msgid "choose index" msgstr "numéro de choix" -#: draw/models.py:439 +#: draw/models.py:440 msgid "" "The choice order in the pool, between 0 and the size of the pool minus 1." msgstr "" "L'ordre de choix dans la poule, entre 0 et la taille de la poule moins 1." -#: draw/models.py:445 draw/models.py:468 participation/models.py:437 -#: participation/models.py:591 +#: draw/models.py:446 draw/models.py:469 participation/models.py:444 +#: participation/models.py:599 #, python-brace-format msgid "Problem #{problem}" msgstr "Problème n°{problem}" -#: draw/models.py:449 draw/models.py:472 +#: draw/models.py:450 draw/models.py:473 msgid "accepted problem" msgstr "problème accepté" -#: draw/models.py:456 +#: draw/models.py:457 msgid "passage dice" msgstr "dé d'ordre de passage" -#: draw/models.py:463 +#: draw/models.py:464 msgid "choice dice" msgstr "dé d'ordre de choix" -#: draw/models.py:477 +#: draw/models.py:478 msgid "rejected problems" msgstr "problèmes rejetés" -#: draw/models.py:503 +#: draw/models.py:504 #, python-brace-format msgid "Draw of the team {trigram} for the pool {letter}{number}" msgstr "Tirage de l'équipe {trigram} pour la poule {letter}{number}" -#: draw/models.py:509 +#: draw/models.py:510 msgid "team draw" msgstr "tirage d'équipe" -#: draw/models.py:510 +#: draw/models.py:511 msgid "team draws" msgstr "tirages d'équipe" @@ -434,21 +434,21 @@ msgid "selected for final" msgstr "sélectionnée pour la finale" #: participation/admin.py:57 participation/admin.py:116 -#: participation/models.py:444 participation/tables.py:109 +#: participation/models.py:451 participation/tables.py:109 msgid "defender" msgstr "défenseur⋅se" -#: participation/admin.py:61 participation/models.py:451 -#: participation/models.py:634 +#: participation/admin.py:61 participation/models.py:458 +#: participation/models.py:642 msgid "opponent" msgstr "opposant⋅e" -#: participation/admin.py:65 participation/models.py:458 -#: participation/models.py:635 +#: participation/admin.py:65 participation/models.py:465 +#: participation/models.py:643 msgid "reporter" msgstr "rapporteur⋅e" -#: participation/admin.py:120 participation/models.py:589 +#: participation/admin.py:120 participation/models.py:597 msgid "problem" msgstr "numéro de problème" @@ -699,14 +699,18 @@ msgid "Pool of day {round} for tournament {tournament} with teams {teams}" msgstr "Poule du jour {round} du tournoi {tournament} avec les équipes {teams}" #: participation/models.py:435 +msgid "position" +msgstr "position" + +#: participation/models.py:442 msgid "defended solution" msgstr "solution défendue" -#: participation/models.py:463 +#: participation/models.py:470 msgid "penalties" msgstr "pénalités" -#: participation/models.py:465 +#: participation/models.py:472 msgid "" "Number of penalties for the defender. The defender will loose a 0.5 " "coefficient per penalty." @@ -714,120 +718,120 @@ msgstr "" "Nombre de pénalités pour læ défenseur⋅se. Læ défenseur⋅se perd un " "coefficient 0.5 sur sa présentation orale par pénalité." -#: participation/models.py:525 participation/models.py:528 -#: participation/models.py:531 +#: participation/models.py:532 participation/models.py:535 +#: participation/models.py:538 #, python-brace-format msgid "Team {trigram} is not registered in the pool." msgstr "L'équipe {trigram} n'est pas inscrite dans la poule." -#: participation/models.py:536 +#: participation/models.py:543 #, python-brace-format msgid "Passage of {defender} for problem {problem}" msgstr "Passage de {defender} pour le problème {problem}" -#: participation/models.py:540 participation/models.py:548 -#: participation/models.py:629 participation/models.py:671 +#: participation/models.py:547 participation/models.py:556 +#: participation/models.py:637 participation/models.py:679 msgid "passage" msgstr "passage" -#: participation/models.py:541 +#: participation/models.py:548 msgid "passages" msgstr "passages" -#: participation/models.py:559 +#: participation/models.py:567 msgid "difference" msgstr "différence" -#: participation/models.py:560 +#: participation/models.py:568 msgid "Score to add/remove on the final score" msgstr "Score à ajouter/retrancher au score final" -#: participation/models.py:567 +#: participation/models.py:575 msgid "tweak" msgstr "harmonisation" -#: participation/models.py:568 +#: participation/models.py:576 msgid "tweaks" msgstr "harmonisations" -#: participation/models.py:596 +#: participation/models.py:604 msgid "solution for the final tournament" msgstr "solution pour la finale" -#: participation/models.py:601 participation/models.py:640 +#: participation/models.py:609 participation/models.py:648 msgid "file" msgstr "fichier" -#: participation/models.py:607 +#: participation/models.py:615 #, python-brace-format msgid "Solution of team {team} for problem {problem}" msgstr "Solution de l'équipe {team} pour le problème {problem}" -#: participation/models.py:609 +#: participation/models.py:617 msgid "for final" msgstr "pour la finale" -#: participation/models.py:612 +#: participation/models.py:620 msgid "solution" msgstr "solution" -#: participation/models.py:613 +#: participation/models.py:621 msgid "solutions" msgstr "solutions" -#: participation/models.py:646 +#: participation/models.py:654 #, python-brace-format msgid "Synthesis of {team} as {type} for problem {problem} of {defender}" msgstr "" "Note de synthèse de l'équipe {team} en tant que {type} pour le problème " "{problem} de {defender}" -#: participation/models.py:654 +#: participation/models.py:662 msgid "synthesis" msgstr "note de synthèse" -#: participation/models.py:655 +#: participation/models.py:663 msgid "syntheses" msgstr "notes de synthèse" -#: participation/models.py:664 +#: participation/models.py:672 msgid "jury" msgstr "jury" -#: participation/models.py:676 +#: participation/models.py:684 msgid "defender writing note" msgstr "note d'écrit de læ défenseur⋅se" -#: participation/models.py:682 +#: participation/models.py:690 msgid "defender oral note" msgstr "note d'oral de læ défenseur⋅se" -#: participation/models.py:688 +#: participation/models.py:696 msgid "opponent writing note" msgstr "note d'écrit de l'opposant⋅e" -#: participation/models.py:694 +#: participation/models.py:702 msgid "opponent oral note" msgstr "note d'oral de l'opposant⋅e" -#: participation/models.py:700 +#: participation/models.py:708 msgid "reporter writing note" msgstr "note d'écrit de læ rapporteur⋅e" -#: participation/models.py:706 +#: participation/models.py:714 msgid "reporter oral note" msgstr "note d'oral de læ rapporteur⋅e" -#: participation/models.py:724 +#: participation/models.py:732 #, python-brace-format msgid "Notes of {jury} for {passage}" msgstr "Notes de {jury} pour le {passage}" -#: participation/models.py:731 +#: participation/models.py:739 msgid "note" msgstr "note" -#: participation/models.py:732 +#: participation/models.py:740 msgid "notes" msgstr "notes" @@ -907,9 +911,9 @@ msgid "Join" msgstr "Rejoindre" #: participation/templates/participation/note_form.html:11 -#: participation/templates/participation/passage_detail.html:46 -#: participation/templates/participation/passage_detail.html:102 -#: participation/templates/participation/passage_detail.html:108 +#: participation/templates/participation/passage_detail.html:49 +#: participation/templates/participation/passage_detail.html:105 +#: participation/templates/participation/passage_detail.html:111 #: participation/templates/participation/pool_add_jurys.html:35 #: participation/templates/participation/pool_detail.html:88 #: participation/templates/participation/pool_detail.html:106 @@ -976,7 +980,7 @@ msgid "Upload solution" msgstr "Envoyer une solution" #: participation/templates/participation/participation_detail.html:59 -#: participation/templates/participation/passage_detail.html:114 +#: participation/templates/participation/passage_detail.html:117 #: participation/templates/participation/pool_detail.html:116 #: participation/templates/participation/team_detail.html:185 #: participation/templates/participation/upload_motivation_letter.html:13 @@ -1000,84 +1004,88 @@ msgid "Pool:" msgstr "Poule :" #: participation/templates/participation/passage_detail.html:16 +msgid "Position:" +msgstr "Position :" + +#: participation/templates/participation/passage_detail.html:19 msgid "Defender:" msgstr "Défenseur⋅se :" -#: participation/templates/participation/passage_detail.html:19 +#: participation/templates/participation/passage_detail.html:22 msgid "Opponent:" msgstr "Opposant⋅e :" -#: participation/templates/participation/passage_detail.html:22 +#: participation/templates/participation/passage_detail.html:25 msgid "Reporter:" msgstr "Rapporteur⋅e :" -#: participation/templates/participation/passage_detail.html:25 +#: participation/templates/participation/passage_detail.html:28 msgid "Defended solution:" msgstr "Solution défendue" -#: participation/templates/participation/passage_detail.html:28 +#: participation/templates/participation/passage_detail.html:31 msgid "Defender penalties count:" msgstr "Nombre de pénalités :" -#: participation/templates/participation/passage_detail.html:31 +#: participation/templates/participation/passage_detail.html:34 msgid "Syntheses:" msgstr "Notes de synthèse :" -#: participation/templates/participation/passage_detail.html:36 +#: participation/templates/participation/passage_detail.html:39 msgid "No synthesis was uploaded yet." msgstr "Aucune note de synthèse n'a encore été envoyée." -#: participation/templates/participation/passage_detail.html:44 -#: participation/templates/participation/passage_detail.html:107 +#: participation/templates/participation/passage_detail.html:47 +#: participation/templates/participation/passage_detail.html:110 msgid "Update notes" msgstr "Modifier les notes" -#: participation/templates/participation/passage_detail.html:50 -#: participation/templates/participation/passage_detail.html:113 +#: participation/templates/participation/passage_detail.html:53 +#: participation/templates/participation/passage_detail.html:116 msgid "Upload synthesis" msgstr "Envoyer une note de synthèse" -#: participation/templates/participation/passage_detail.html:58 +#: participation/templates/participation/passage_detail.html:61 msgid "Notes detail" msgstr "Détails des notes" -#: participation/templates/participation/passage_detail.html:65 +#: participation/templates/participation/passage_detail.html:68 msgid "Average points for the defender writing:" msgstr "Moyenne de l'écrit de læ défenseur⋅se :" -#: participation/templates/participation/passage_detail.html:68 +#: participation/templates/participation/passage_detail.html:71 msgid "Average points for the defender oral:" msgstr "Moyenne de l'oral de læ défenseur⋅se :" -#: participation/templates/participation/passage_detail.html:71 +#: participation/templates/participation/passage_detail.html:74 msgid "Average points for the opponent writing:" msgstr "Moyenne de l'écrit de l'opposant⋅e :" -#: participation/templates/participation/passage_detail.html:74 +#: participation/templates/participation/passage_detail.html:77 msgid "Average points for the opponent oral:" msgstr "Moyenne de l'oral de l'opposant⋅e :" -#: participation/templates/participation/passage_detail.html:77 +#: participation/templates/participation/passage_detail.html:80 msgid "Average points for the reporter writing:" msgstr "Moyenne de l'écrit de læ rapporteur⋅e :" -#: participation/templates/participation/passage_detail.html:80 +#: participation/templates/participation/passage_detail.html:83 msgid "Average points for the reporter oral:" msgstr "Moyenne de l'oral de læ rapporteur⋅e :" -#: participation/templates/participation/passage_detail.html:87 +#: participation/templates/participation/passage_detail.html:90 msgid "Defender points:" msgstr "Points de læ défenseur⋅se :" -#: participation/templates/participation/passage_detail.html:90 +#: participation/templates/participation/passage_detail.html:93 msgid "Opponent points:" msgstr "Points de l'opposant⋅e :" -#: participation/templates/participation/passage_detail.html:93 +#: participation/templates/participation/passage_detail.html:96 msgid "Reporter points:" msgstr "Points de læ rapporteur⋅e :" -#: participation/templates/participation/passage_detail.html:101 +#: participation/templates/participation/passage_detail.html:104 #: participation/templates/participation/passage_form.html:11 msgid "Update passage" msgstr "Modifier le passage" diff --git a/participation/forms.py b/participation/forms.py index bc6c67a..d1f30c3 100644 --- a/participation/forms.py +++ b/participation/forms.py @@ -323,7 +323,7 @@ class PassageForm(forms.ModelForm): class Meta: model = Passage - fields = ('solution_number', 'defender', 'opponent', 'reporter', 'defender_penalties',) + fields = ('position', 'solution_number', 'defender', 'opponent', 'reporter', 'defender_penalties',) class SynthesisForm(forms.ModelForm): diff --git a/participation/migrations/0006_alter_passage_options_passage_position_and_more.py b/participation/migrations/0006_alter_passage_options_passage_position_and_more.py new file mode 100644 index 0000000..3fd54c8 --- /dev/null +++ b/participation/migrations/0006_alter_passage_options_passage_position_and_more.py @@ -0,0 +1,44 @@ +# Generated by Django 4.2 on 2023-04-06 22:05 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("participation", "0005_alter_team_options"), + ] + + operations = [ + migrations.AlterModelOptions( + name="passage", + options={ + "ordering": ("pool", "position"), + "verbose_name": "passage", + "verbose_name_plural": "passages", + }, + ), + migrations.AddField( + model_name="passage", + name="position", + field=models.PositiveSmallIntegerField( + choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)], + default=1, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(5), + ], + verbose_name="position", + ), + ), + migrations.AlterField( + model_name="participation", + name="valid", + field=models.BooleanField( + default=None, + help_text="The participation got the validation of the organizers.", + null=True, + verbose_name="valid team", + ), + ), + ] diff --git a/participation/models.py b/participation/models.py index 29eec9e..00cd7f7 100644 --- a/participation/models.py +++ b/participation/models.py @@ -6,7 +6,7 @@ import os from django.conf import settings from django.core.exceptions import ValidationError -from django.core.validators import RegexValidator +from django.core.validators import MaxValueValidator, MinValueValidator, RegexValidator from django.db import models from django.db.models import Index from django.urls import reverse_lazy @@ -431,6 +431,13 @@ class Passage(models.Model): related_name="passages", ) + position = models.PositiveSmallIntegerField( + verbose_name=_("position"), + choices=zip(range(1, 6), range(1, 6)), + default=1, + validators=[MinValueValidator(1), MaxValueValidator(5)], + ) + solution_number = models.PositiveSmallIntegerField( verbose_name=_("defended solution"), choices=[ @@ -539,6 +546,7 @@ class Passage(models.Model): class Meta: verbose_name = _("passage") verbose_name_plural = _("passages") + ordering = ('pool', 'position',) class Tweak(models.Model): diff --git a/participation/templates/participation/passage_detail.html b/participation/templates/participation/passage_detail.html index 3df87a3..ae3af24 100644 --- a/participation/templates/participation/passage_detail.html +++ b/participation/templates/participation/passage_detail.html @@ -13,6 +13,9 @@
{% trans "Pool:" %}
{{ passage.pool }}
+
{% trans "Position:" %}
+
{{ passage.position }}
+
{% trans "Defender:" %}
{{ passage.defender.team }}
diff --git a/registration/migrations/0008_alter_payment_valid.py b/registration/migrations/0008_alter_payment_valid.py new file mode 100644 index 0000000..590da94 --- /dev/null +++ b/registration/migrations/0008_alter_payment_valid.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2 on 2023-04-06 22:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("registration", "0007_alter_participantregistration_options_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="payment", + name="valid", + field=models.BooleanField( + default=False, null=True, verbose_name="payment valid" + ), + ), + ]