From 0fa76d6f25904b3b40793bc46230a31c91a2dfa6 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Fri, 31 Mar 2023 17:23:40 +0200 Subject: [PATCH] Add letter in pool display Signed-off-by: Emmy D'Anello --- draw/migrations/0008_alter_pool_letter.py | 19 ++ draw/models.py | 2 + locale/fr/LC_MESSAGES/django.po | 189 +++++++++--------- participation/forms.py | 2 +- .../0004_alter_pool_options_pool_letter.py | 30 +++ participation/models.py | 11 + participation/tables.py | 11 +- .../templates/participation/pool_detail.html | 3 + 8 files changed, 168 insertions(+), 99 deletions(-) create mode 100644 draw/migrations/0008_alter_pool_letter.py create mode 100644 participation/migrations/0004_alter_pool_options_pool_letter.py diff --git a/draw/migrations/0008_alter_pool_letter.py b/draw/migrations/0008_alter_pool_letter.py new file mode 100644 index 0000000..e26dee6 --- /dev/null +++ b/draw/migrations/0008_alter_pool_letter.py @@ -0,0 +1,19 @@ +# Generated by Django 4.1.7 on 2023-03-31 15:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("draw", "0007_remove_teamdraw_last_dice_teamdraw_choice_dice_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="pool", + name="letter", + field=models.PositiveSmallIntegerField( + choices=[(1, "A"), (2, "B"), (3, "C"), (4, "D")], verbose_name="letter" + ), + ), + ] diff --git a/draw/models.py b/draw/models.py index bca165a..3cd0fba 100644 --- a/draw/models.py +++ b/draw/models.py @@ -166,6 +166,7 @@ class Pool(models.Model): (1, 'A'), (2, 'B'), (3, 'C'), + (4, 'D'), ], verbose_name=_('letter'), ) @@ -224,6 +225,7 @@ class Pool(models.Model): self.associated_pool = PPool.objects.create( tournament=self.round.draw.tournament, round=self.round.number, + letter=self.letter, ) self.associated_pool.juries.set(self.round.draw.tournament.organizers.all()) tds = list(self.team_draws) diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index bdc11a3..1cdba85 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-03-31 17:14+0200\n" +"POT-Creation-Date: 2023-03-31 17:22+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Emmy D'Anello \n" "Language-Team: LANGUAGE \n" @@ -117,7 +117,7 @@ msgstr "numéro" msgid "current pool" msgstr "poule actuelle" -#: draw/models.py:154 draw/models.py:283 participation/models.py:355 +#: draw/models.py:154 draw/models.py:285 participation/models.py:355 msgid "round" msgstr "tour" @@ -125,74 +125,74 @@ msgstr "tour" msgid "rounds" msgstr "tours" -#: draw/models.py:170 +#: draw/models.py:171 participation/models.py:369 msgid "letter" msgstr "lettre" -#: draw/models.py:174 +#: draw/models.py:175 #: participation/templates/participation/tournament_detail.html:15 msgid "size" msgstr "taille" -#: draw/models.py:183 +#: draw/models.py:184 msgid "current team" msgstr "équipe actuelle" -#: draw/models.py:192 +#: draw/models.py:193 msgid "associated pool" msgstr "poule associée" -#: draw/models.py:269 draw/models.py:291 +#: draw/models.py:271 draw/models.py:293 #: draw/templates/draw/tournament_content.html:70 -#: draw/templates/draw/tournament_content.html:185 participation/models.py:407 -#: participation/models.py:415 +#: draw/templates/draw/tournament_content.html:185 participation/models.py:417 +#: participation/models.py:426 participation/tables.py:82 msgid "pool" msgstr "poule" -#: draw/models.py:270 participation/models.py:408 +#: draw/models.py:272 participation/models.py:418 msgid "pools" msgstr "poules" -#: draw/models.py:277 participation/models.py:342 participation/models.py:539 -#: participation/models.py:569 participation/models.py:607 +#: draw/models.py:279 participation/models.py:342 participation/models.py:550 +#: participation/models.py:580 participation/models.py:618 msgid "participation" msgstr "participation" -#: draw/models.py:298 +#: draw/models.py:300 msgid "passage index" msgstr "numéro de passage" -#: draw/models.py:305 +#: draw/models.py:307 msgid "choose index" msgstr "numéro de choix" -#: draw/models.py:310 draw/models.py:333 participation/models.py:422 -#: participation/models.py:576 +#: draw/models.py:312 draw/models.py:335 participation/models.py:433 +#: participation/models.py:587 #, python-brace-format msgid "Problem #{problem}" msgstr "Problème n°{problem}" -#: draw/models.py:314 draw/models.py:337 +#: draw/models.py:316 draw/models.py:339 msgid "accepted problem" msgstr "problème accepté" -#: draw/models.py:321 +#: draw/models.py:323 msgid "passage dice" msgstr "dé d'ordre passage" -#: draw/models.py:328 +#: draw/models.py:330 msgid "choice dice" msgstr "dé d'ordre de choix" -#: draw/models.py:342 +#: draw/models.py:344 msgid "rejected problems" msgstr "problèmes rejetés" -#: draw/models.py:358 +#: draw/models.py:360 msgid "team draw" msgstr "tirage d'équipe" -#: draw/models.py:359 +#: draw/models.py:361 msgid "team draws" msgstr "tirages d'équipe" @@ -430,7 +430,7 @@ msgstr "lettre de motivation" msgid "Team {name} ({trigram})" msgstr "Équipe {name} ({trigram})" -#: participation/models.py:126 participation/tables.py:82 +#: participation/models.py:126 participation/tables.py:86 msgid "teams" msgstr "équipes" @@ -520,7 +520,7 @@ msgstr "L'équipe est sélectionnée pour la finale." msgid "Participation of the team {name} ({trigram})" msgstr "Participation de l'équipe {name} ({trigram})" -#: participation/models.py:343 participation/models.py:365 +#: participation/models.py:343 participation/models.py:375 msgid "participations" msgstr "participations" @@ -529,23 +529,23 @@ msgstr "participations" msgid "Round {round}" msgstr "Tour {round}" -#: participation/models.py:371 +#: participation/models.py:381 msgid "juries" msgstr "jurys" -#: participation/models.py:378 +#: participation/models.py:388 msgid "BigBlueButton URL" msgstr "Lien BigBlueButton" -#: participation/models.py:379 +#: participation/models.py:389 msgid "The link of the BBB visio for this pool." msgstr "Le lien du salon BBB pour cette poule." -#: participation/models.py:384 +#: participation/models.py:394 msgid "results available" msgstr "résultats disponibles" -#: participation/models.py:385 +#: participation/models.py:395 msgid "" "Check this case when results become accessible to teams. They stay " "accessible to you. Only averages are given." @@ -554,32 +554,32 @@ msgstr "" "Ils restent toujours accessibles pour vous. Seules les moyennes sont " "communiquées." -#: participation/models.py:401 +#: participation/models.py:411 #, python-brace-format 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:420 +#: participation/models.py:431 msgid "defended solution" msgstr "solution défendue" -#: participation/models.py:429 participation/tables.py:102 +#: participation/models.py:440 participation/tables.py:109 msgid "defender" msgstr "défenseur⋅se" -#: participation/models.py:436 participation/models.py:619 +#: participation/models.py:447 participation/models.py:630 msgid "opponent" msgstr "opposant⋅e" -#: participation/models.py:443 participation/models.py:620 +#: participation/models.py:454 participation/models.py:631 msgid "reporter" msgstr "rapporteur⋅e" -#: participation/models.py:448 +#: participation/models.py:459 msgid "penalties" msgstr "pénalités" -#: participation/models.py:450 +#: participation/models.py:461 msgid "" "Number of penalties for the defender. The defender will loose a 0.5 " "coefficient per penalty." @@ -587,124 +587,124 @@ 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:510 participation/models.py:513 -#: participation/models.py:516 +#: participation/models.py:521 participation/models.py:524 +#: participation/models.py:527 #, 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:521 +#: participation/models.py:532 #, python-brace-format msgid "Passage of {defender} for problem {problem}" msgstr "Passage de {defender} pour le problème {problem}" -#: participation/models.py:525 participation/models.py:533 -#: participation/models.py:614 participation/models.py:656 +#: participation/models.py:536 participation/models.py:544 +#: participation/models.py:625 participation/models.py:667 msgid "passage" msgstr "passage" -#: participation/models.py:526 +#: participation/models.py:537 msgid "passages" msgstr "passages" -#: participation/models.py:544 +#: participation/models.py:555 msgid "difference" msgstr "différence" -#: participation/models.py:545 +#: participation/models.py:556 msgid "Score to add/remove on the final score" msgstr "Score à ajouter/retrancher au score final" -#: participation/models.py:552 +#: participation/models.py:563 msgid "tweak" msgstr "harmonisation" -#: participation/models.py:553 +#: participation/models.py:564 msgid "tweaks" msgstr "harmonisations" -#: participation/models.py:574 +#: participation/models.py:585 msgid "problem" msgstr "numéro de problème" -#: participation/models.py:581 +#: participation/models.py:592 msgid "solution for the final tournament" msgstr "solution pour la finale" -#: participation/models.py:586 participation/models.py:625 +#: participation/models.py:597 participation/models.py:636 msgid "file" msgstr "fichier" -#: participation/models.py:592 +#: participation/models.py:603 #, 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:594 +#: participation/models.py:605 msgid "for final" msgstr "pour la finale" -#: participation/models.py:597 +#: participation/models.py:608 msgid "solution" msgstr "solution" -#: participation/models.py:598 +#: participation/models.py:609 msgid "solutions" msgstr "solutions" -#: participation/models.py:631 +#: participation/models.py:642 #, 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:639 +#: participation/models.py:650 msgid "synthesis" msgstr "note de synthèse" -#: participation/models.py:640 +#: participation/models.py:651 msgid "syntheses" msgstr "notes de synthèse" -#: participation/models.py:649 +#: participation/models.py:660 msgid "jury" msgstr "jury" -#: participation/models.py:661 +#: participation/models.py:672 msgid "defender writing note" msgstr "note d'écrit de læ défenseur⋅se" -#: participation/models.py:667 +#: participation/models.py:678 msgid "defender oral note" msgstr "note d'oral de læ défenseur⋅se" -#: participation/models.py:673 +#: participation/models.py:684 msgid "opponent writing note" msgstr "note d'écrit de l'opposant⋅e" -#: participation/models.py:679 +#: participation/models.py:690 msgid "opponent oral note" msgstr "note d'oral de l'opposant⋅e" -#: participation/models.py:685 +#: participation/models.py:696 msgid "reporter writing note" msgstr "note d'écrit de læ rapporteur⋅e" -#: participation/models.py:691 +#: participation/models.py:702 msgid "reporter oral note" msgstr "note d'oral de læ rapporteur⋅e" -#: participation/models.py:709 +#: participation/models.py:720 #, python-brace-format msgid "Notes of {jury} for {passage}" msgstr "Notes de {jury} pour le {passage}" -#: participation/models.py:716 +#: participation/models.py:727 msgid "note" msgstr "note" -#: participation/models.py:717 +#: participation/models.py:728 msgid "notes" msgstr "notes" @@ -729,7 +729,12 @@ msgstr "date" msgid "From {start} to {end}" msgstr "Du {start} au {end}" -#: participation/tables.py:88 +#: participation/tables.py:91 +#, python-brace-format +msgid "Pool {letter}{round}" +msgstr "Poule {letter}{round}" + +#: participation/tables.py:95 msgid "No defined team" msgstr "Pas d'équipe définie" @@ -782,9 +787,9 @@ msgstr "Rejoindre" #: participation/templates/participation/passage_detail.html:46 #: participation/templates/participation/passage_detail.html:102 #: participation/templates/participation/passage_detail.html:108 -#: participation/templates/participation/pool_detail.html:55 -#: participation/templates/participation/pool_detail.html:74 -#: participation/templates/participation/pool_detail.html:79 +#: participation/templates/participation/pool_detail.html:58 +#: participation/templates/participation/pool_detail.html:77 +#: participation/templates/participation/pool_detail.html:82 #: participation/templates/participation/team_detail.html:126 #: participation/templates/participation/team_detail.html:190 #: participation/templates/participation/tournament_form.html:12 @@ -848,7 +853,7 @@ msgstr "Envoyer une solution" #: participation/templates/participation/participation_detail.html:59 #: participation/templates/participation/passage_detail.html:114 -#: participation/templates/participation/pool_detail.html:84 +#: participation/templates/participation/pool_detail.html:87 #: participation/templates/participation/team_detail.html:185 #: participation/templates/participation/upload_motivation_letter.html:13 #: participation/templates/participation/upload_notes.html:12 @@ -958,55 +963,59 @@ msgid "Round:" msgstr "Tour :" #: participation/templates/participation/pool_detail.html:18 +msgid "Letter:" +msgstr "Lettre :" + +#: participation/templates/participation/pool_detail.html:21 msgid "Teams:" msgstr "Équipes :" -#: participation/templates/participation/pool_detail.html:25 +#: participation/templates/participation/pool_detail.html:28 msgid "Juries:" msgstr "Jurys :" -#: participation/templates/participation/pool_detail.html:28 +#: participation/templates/participation/pool_detail.html:31 msgid "Defended solutions:" msgstr "Solutions défendues :" -#: participation/templates/participation/pool_detail.html:35 +#: participation/templates/participation/pool_detail.html:38 msgid "BigBlueButton link:" msgstr "Lien BigBlueButton :" -#: participation/templates/participation/pool_detail.html:41 +#: participation/templates/participation/pool_detail.html:44 #: participation/templates/participation/tournament_detail.html:97 msgid "Ranking" msgstr "Classement" -#: participation/templates/participation/pool_detail.html:54 -#: participation/templates/participation/pool_detail.html:68 +#: participation/templates/participation/pool_detail.html:57 +#: participation/templates/participation/pool_detail.html:71 msgid "Add passage" msgstr "Ajouter un passage" -#: participation/templates/participation/pool_detail.html:56 -#: participation/templates/participation/pool_detail.html:78 +#: participation/templates/participation/pool_detail.html:59 +#: participation/templates/participation/pool_detail.html:81 msgid "Update teams" msgstr "Modifier les équipes" -#: participation/templates/participation/pool_detail.html:57 +#: participation/templates/participation/pool_detail.html:60 msgid "Upload notes from a CSV file" msgstr "Soumettre les notes à partir d'un fichier CSV" -#: participation/templates/participation/pool_detail.html:64 +#: participation/templates/participation/pool_detail.html:67 msgid "Passages" msgstr "Passages" -#: participation/templates/participation/pool_detail.html:69 +#: participation/templates/participation/pool_detail.html:72 #: participation/templates/participation/tournament_detail.html:111 msgid "Add" msgstr "Ajouter" -#: participation/templates/participation/pool_detail.html:73 +#: participation/templates/participation/pool_detail.html:76 #: participation/templates/participation/pool_form.html:11 msgid "Update pool" msgstr "Modifier la poule" -#: participation/templates/participation/pool_detail.html:83 +#: participation/templates/participation/pool_detail.html:86 msgid "Upload notes" msgstr "Envoyer les notes" @@ -2231,15 +2240,3 @@ msgstr "Résultats" #: tfjm/templates/search/search.html:25 msgid "No results found." msgstr "Aucun résultat." - -#~ msgid "Two pools are identical. Please relaunch your dices." -#~ msgstr "Deux poules sont identiques. Merci de relancer vos dés." - -#~ msgid "last dice" -#~ msgstr "dernier dé" - -#~ msgid "Problem" -#~ msgstr "Problème" - -#~ msgid "index" -#~ msgstr "position" diff --git a/participation/forms.py b/participation/forms.py index b128c80..81a56cd 100644 --- a/participation/forms.py +++ b/participation/forms.py @@ -170,7 +170,7 @@ class SolutionForm(forms.ModelForm): class PoolForm(forms.ModelForm): class Meta: model = Pool - fields = ('tournament', 'round', 'bbb_url', 'results_available', 'juries',) + fields = ('tournament', 'round', 'letter', 'bbb_url', 'results_available', 'juries',) widgets = { "juries": forms.SelectMultiple(attrs={ 'class': 'selectpicker', diff --git a/participation/migrations/0004_alter_pool_options_pool_letter.py b/participation/migrations/0004_alter_pool_options_pool_letter.py new file mode 100644 index 0000000..02d5cac --- /dev/null +++ b/participation/migrations/0004_alter_pool_options_pool_letter.py @@ -0,0 +1,30 @@ +# Generated by Django 4.1.7 on 2023-03-31 15:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("participation", "0003_alter_team_trigram"), + ] + + operations = [ + migrations.AlterModelOptions( + name="pool", + options={ + "ordering": ("round", "letter"), + "verbose_name": "pool", + "verbose_name_plural": "pools", + }, + ), + migrations.AddField( + model_name="pool", + name="letter", + field=models.PositiveSmallIntegerField( + choices=[(1, "A"), (2, "B"), (3, "C"), (4, "D")], + default=1, + verbose_name="letter", + ), + preserve_default=False, + ), + ] diff --git a/participation/models.py b/participation/models.py index 3df3a77..98c27d1 100644 --- a/participation/models.py +++ b/participation/models.py @@ -359,6 +359,16 @@ class Pool(models.Model): ] ) + letter = models.PositiveSmallIntegerField( + choices=[ + (1, 'A'), + (2, 'B'), + (3, 'C'), + (4, 'D'), + ], + verbose_name=_('letter'), + ) + participations = models.ManyToManyField( Participation, related_name="pools", @@ -406,6 +416,7 @@ class Pool(models.Model): class Meta: verbose_name = _("pool") verbose_name_plural = _("pools") + ordering = ('round', 'letter',) class Passage(models.Model): diff --git a/participation/tables.py b/participation/tables.py index a3525d8..29d82e4 100644 --- a/participation/tables.py +++ b/participation/tables.py @@ -76,13 +76,20 @@ class TournamentTable(tables.Table): class PoolTable(tables.Table): - teams = tables.LinkColumn( + letter = tables.LinkColumn( 'participation:pool_detail', args=[tables.A('id')], + verbose_name=_("pool").capitalize, + ) + + teams = tables.Column( verbose_name=_("teams").capitalize, empty_values=(), ) + def render_letter(self, record): + return format_lazy(_("Pool {letter}{round}"), letter=record.get_letter_display(), round=record.round) + def render_teams(self, record): return ", ".join(participation.team.trigram for participation in record.participations.all()) \ or _("No defined team") @@ -92,7 +99,7 @@ class PoolTable(tables.Table): 'class': 'table table-condensed table-striped', } model = Pool - fields = ('teams', 'round', 'tournament',) + fields = ('letter', 'teams', 'round', 'tournament',) class PassageTable(tables.Table): diff --git a/participation/templates/participation/pool_detail.html b/participation/templates/participation/pool_detail.html index f66ea85..1a59ed5 100644 --- a/participation/templates/participation/pool_detail.html +++ b/participation/templates/participation/pool_detail.html @@ -15,6 +15,9 @@
{% trans "Round:" %}
{{ pool.get_round_display }}
+
{% trans "Letter:" %}
+
{{ pool.get_letter_display }}
+
{% trans "Teams:" %}
{% for participation in pool.participations.all %}