From bc67d1cf1fc3052e9e4fb3257aeb99511839e258 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sun, 11 Feb 2024 22:24:22 +0100 Subject: [PATCH] Add information about team registration Signed-off-by: Emmy D'Anello --- locale/fr/LC_MESSAGES/django.po | 313 +++++++++++++++++++------------- participation/models.py | 130 +++++++++---- 2 files changed, 273 insertions(+), 170 deletions(-) diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 269f5d1..eae1d83 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: 2024-02-11 20:13+0100\n" +"POT-Creation-Date: 2024-02-11 22:18+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Emmy D'Anello \n" "Language-Team: LANGUAGE \n" @@ -22,19 +22,19 @@ msgid "API" msgstr "API" #: draw/admin.py:16 draw/admin.py:28 draw/admin.py:44 participation/admin.py:44 -#: participation/models.py:198 participation/tables.py:87 +#: participation/models.py:248 participation/tables.py:87 msgid "teams" msgstr "équipes" #: draw/admin.py:40 draw/admin.py:56 draw/models.py:24 #: participation/admin.py:16 participation/admin.py:73 -#: participation/admin.py:104 participation/models.py:367 -#: participation/models.py:391 participation/models.py:424 +#: participation/admin.py:104 participation/models.py:417 +#: participation/models.py:441 participation/models.py:474 msgid "tournament" msgstr "tournoi" #: draw/admin.py:60 draw/models.py:231 draw/models.py:426 -#: participation/models.py:428 +#: participation/models.py:478 msgid "round" msgstr "tour" @@ -168,7 +168,7 @@ msgstr "La poule en cours, où les équipes choisissent leurs problèmes" msgid "rounds" msgstr "tours" -#: draw/models.py:254 participation/models.py:442 +#: draw/models.py:254 participation/models.py:492 msgid "letter" msgstr "lettre" @@ -207,17 +207,17 @@ msgid "Pool {letter}{number}" msgstr "Poule {letter}{number}" #: draw/models.py:407 draw/models.py:434 participation/admin.py:69 -#: participation/admin.py:88 participation/models.py:494 -#: participation/models.py:503 participation/tables.py:83 +#: participation/admin.py:88 participation/models.py:544 +#: participation/models.py:553 participation/tables.py:83 msgid "pool" msgstr "poule" -#: draw/models.py:408 participation/models.py:495 +#: draw/models.py:408 participation/models.py:545 msgid "pools" msgstr "poules" -#: draw/models.py:420 participation/models.py:414 participation/models.py:664 -#: participation/models.py:694 participation/models.py:732 +#: draw/models.py:420 participation/models.py:464 participation/models.py:714 +#: participation/models.py:744 participation/models.py:782 msgid "participation" msgstr "participation" @@ -241,8 +241,8 @@ msgid "" msgstr "" "L'ordre de choix dans la poule, entre 0 et la taille de la poule moins 1." -#: draw/models.py:457 draw/models.py:480 participation/models.py:517 -#: participation/models.py:701 +#: draw/models.py:457 draw/models.py:480 participation/models.py:567 +#: participation/models.py:751 #, python-brace-format msgid "Problem #{problem}" msgstr "Problème n°{problem}" @@ -325,7 +325,7 @@ msgid "Continue draw" msgstr "Continuer le tirage" #: draw/templates/draw/tournament_content.html:216 participation/admin.py:100 -#: participation/models.py:197 participation/models.py:382 +#: participation/models.py:247 participation/models.py:432 #: registration/models.py:146 msgid "team" msgstr "équipe" @@ -442,26 +442,26 @@ msgstr "Changelog de type \"{action}\" pour le modèle {model} le {timestamp}" msgid "valid" msgstr "valide" -#: participation/admin.py:24 participation/models.py:403 +#: participation/admin.py:24 participation/models.py:453 msgid "selected for final" msgstr "sélectionnée pour la finale" #: participation/admin.py:57 participation/admin.py:116 -#: participation/models.py:524 participation/tables.py:111 +#: participation/models.py:574 participation/tables.py:111 msgid "defender" msgstr "défenseur⋅se" -#: participation/admin.py:61 participation/models.py:531 -#: participation/models.py:744 +#: participation/admin.py:61 participation/models.py:581 +#: participation/models.py:794 msgid "opponent" msgstr "opposant⋅e" -#: participation/admin.py:65 participation/models.py:538 -#: participation/models.py:745 +#: participation/admin.py:65 participation/models.py:588 +#: participation/models.py:795 msgid "reporter" msgstr "rapporteur⋅e" -#: participation/admin.py:120 participation/models.py:699 +#: participation/admin.py:120 participation/models.py:749 msgid "problem" msgstr "numéro de problème" @@ -568,7 +568,7 @@ msgstr "Ce⋅tte défenseur⋅se ne travaille pas sur ce problème." msgid "The PDF file must not have more than 2 pages." msgstr "Le fichier PDF ne doit pas avoir plus de 2 pages." -#: participation/models.py:32 participation/models.py:208 +#: participation/models.py:32 participation/models.py:258 #: participation/tables.py:17 participation/tables.py:33 msgid "name" msgstr "nom" @@ -593,191 +593,244 @@ msgstr "Le code d'accès permet aux autres participants de rejoindre l'équipe." msgid "motivation letter" msgstr "lettre de motivation" -#: participation/models.py:94 +#: participation/models.py:96 #, python-brace-format msgid "" -"The team is not registered to any tournament. You can register the team to a " -"tournament using this link." +"The team {trigram} is not registered to any tournament. You can register the " +"team to a tournament using this link." msgstr "" -"L'équipe n'est inscrite à aucun tournoi. Vous pouvez inscrire l'équipe à un " -"tournoi en cliquant sur ce lien." +"L'équipe {trigram} n'est inscrite à aucun tournoi. Vous pouvez inscrire " +"l'équipe à un tournoi en cliquant sur ce lien." -#: participation/models.py:99 +#: participation/models.py:101 msgid "No tournament" msgstr "Pas de tournoi" -#: participation/models.py:105 +#: participation/models.py:107 +msgid "" +"Registrations for the tournament of {tournament} are ending on the {date:%Y-" +"%m-%d %H:%M}." +msgstr "" +"Les inscriptions pour le tournoi de {tournament} se terminent le {date:%d/%m/" +"%Y %H:%M}." + +#: participation/models.py:112 +msgid "Registrations closure" +msgstr "Clôture des inscriptions" + +#: participation/models.py:119 #, python-brace-format msgid "" -"The team has not uploaded a motivation letter. You can upload your " +"The team {trigram} has not uploaded a motivation letter. You can upload your " "motivation letter using this link." msgstr "" -"L'équipe n'a pas envoyé de lettre de motivation. Vous pouvez envoyer votre " -"lettre de motivation en cliquant sur ce lien." +"L'équipe {trigram} n'a pas envoyé de lettre de motivation. Vous pouvez " +"envoyer votre lettre de motivation en cliquant sur ce lien." -#: participation/models.py:110 +#: participation/models.py:124 msgid "No motivation letter" msgstr "Pas de lettre de motivation" -#: participation/models.py:117 +#: participation/models.py:133 #, python-brace-format msgid "" -"The team has less than 4 students ({nb_students}).You can invite more " -"students to join the team using the invite code {code}." +"The team {trigram} has less than 4 students ({nb_students}). You can invite " +"more students to join the team using the invite code {code}." msgstr "" -"L'équipe a moins de 4 élèves ({nb_students}). Vous pouvez inviter plus " -"d'élèves à rejoindre l'équipe en utilisant le code d'invitation " +"L'équipe {trigram} a moins de 4 élèves ({nb_students}). Vous pouvez inviter " +"plus d'élèves à rejoindre l'équipe en utilisant le code d'invitation " "{code}." -#: participation/models.py:121 +#: participation/models.py:138 msgid "Not enough students" msgstr "Pas assez d'élèves" -#: participation/models.py:128 +#: participation/models.py:145 #, python-brace-format msgid "" -"The team has no coach.You can invite a coach to join the team using " -"the invite code {code}." +"The team {trigram} has no coach. You can invite a coach to join the team " +"using the invite code {code}." msgstr "" -"L'équipe n'a pas d'encadrant⋅e. Vous pouvez invite un⋅e encadrant⋅e à rejoindre " -"l'équipe en utilisant le code d'invitation {code}." +"L'équipe {trigram} n'a pas d'encadrant⋅e. Vous pouvez invite un⋅e " +"encadrant⋅e à rejoindre l'équipe en utilisant le code d'invitation " +"{code}." -#: participation/models.py:132 +#: participation/models.py:149 msgid "No coach" msgstr "Pas d'encadrant⋅e" -#: participation/models.py:139 +#: participation/models.py:156 #, python-brace-format msgid "" -"The team has more than 6 students ({nb_students}) or more than 2 coaches " -"({nb_coaches}).You have to restrict the number of students and coaches to 6 " -"and 2, respectively." +"The team {trigram} has more than 6 students ({nb_students}) or more than 2 " +"coaches ({nb_coaches}).You have to restrict the number of students and " +"coaches to 6 and 2, respectively." msgstr "" -"L'équipe a plus de 6 élèves ({nb_students}) ou plus de 2 encadrant⋅es " -"({nb_coaches}). Vous devez restreindre le nombre d'élèves et d'encadrant⋅es " -"à 6 et 2, respectivement." +"L'équipe {trigram} a plus de 6 élèves ({nb_students}) ou plus de 2 " +"encadrant⋅es ({nb_coaches}). Vous devez restreindre le nombre d'élèves et " +"d'encadrant⋅es à 6 et 2, respectivement." -#: participation/models.py:143 +#: participation/models.py:161 msgid "Too many members" msgstr "Trop de membres" -#: participation/models.py:194 +#: participation/models.py:168 +#, python-brace-format +msgid "" +"The team {trigram} is ready to be validated. You can request validation on " +"the page of your team." +msgstr "" +"L'équipe {trigram} est prête à être validée. Vous pouvez demander la " +"validation sur la page de votre équipe." + +#: participation/models.py:173 participation/models.py:184 +msgid "Validate team" +msgstr "Valider l'équipe" + +#: participation/models.py:179 +#, python-brace-format +msgid "" +"The team {trigram} has enough participants, but is not ready to be " +"validated. Please make sure that all the participants have uploaded the " +"required documents. To invite more participants, use the invite code " +"{code}." +msgstr "" +"L'équipe {trigram} a assez de participant⋅es, mais n'est pas prête à être " +"validée. Assurez-vous que tou⋅tes les participant⋅es ont envoyé les " +"documents requis. Pour inviter plus de participant⋅es, utilisez le code " +"d'invitation {code}." + +#: participation/models.py:190 +#, python-brace-format +msgid "" +"The team {trigram} has not been validated by the organizers yet. Please be " +"patient." +msgstr "" +"L'équipe {trigram} n'a pas encore été validée par les organisateurices. " +"Merci de patienter." + +#: participation/models.py:193 +msgid "Pending validation" +msgstr "Validation en attente" + +#: participation/models.py:244 #, python-brace-format msgid "Team {name} ({trigram})" msgstr "Équipe {name} ({trigram})" -#: participation/models.py:213 +#: participation/models.py:263 msgid "start" msgstr "début" -#: participation/models.py:218 +#: participation/models.py:268 msgid "end" msgstr "fin" -#: participation/models.py:224 +#: participation/models.py:274 #: participation/templates/participation/tournament_detail.html:18 msgid "place" msgstr "lieu" -#: participation/models.py:228 +#: participation/models.py:278 msgid "max team count" msgstr "nombre maximal d'équipes" -#: participation/models.py:233 +#: participation/models.py:283 #: participation/templates/participation/tournament_detail.html:21 msgid "price" msgstr "prix" -#: participation/models.py:238 +#: participation/models.py:288 #: participation/templates/participation/tournament_detail.html:24 msgid "remote" msgstr "à distance" -#: participation/models.py:243 +#: participation/models.py:293 msgid "limit date for registrations" msgstr "date limite d'inscription" -#: participation/models.py:248 +#: participation/models.py:298 msgid "limit date to upload solutions" msgstr "date limite pour envoyer les solutions" -#: participation/models.py:253 +#: participation/models.py:303 msgid "random draw for solutions" msgstr "tirage au sort des solutions" -#: participation/models.py:258 +#: participation/models.py:308 msgid "limit date to upload the syntheses for the first phase" msgstr "date limite pour envoyer les notes de synthèses pour la première phase" -#: participation/models.py:263 +#: participation/models.py:313 msgid "date when the solutions for the second round become available" msgstr "date à laquelle les solutions pour le second tour sont accessibles" -#: participation/models.py:268 +#: participation/models.py:318 msgid "limit date to upload the syntheses for the second phase" msgstr "date limite d'envoi des notes de synthèse pour la seconde phase" -#: participation/models.py:273 +#: participation/models.py:323 #: participation/templates/participation/tournament_detail.html:48 msgid "description" msgstr "description" -#: participation/models.py:279 +#: participation/models.py:329 #: participation/templates/participation/tournament_detail.html:12 msgid "organizers" msgstr "organisateur⋅rices" -#: participation/models.py:284 +#: participation/models.py:334 msgid "final" msgstr "finale" -#: participation/models.py:368 registration/admin.py:93 +#: participation/models.py:418 registration/admin.py:93 msgid "tournaments" msgstr "tournois" -#: participation/models.py:397 +#: participation/models.py:447 msgid "valid team" msgstr "équipe valide" -#: participation/models.py:398 +#: participation/models.py:448 msgid "The participation got the validation of the organizers." msgstr "La participation a été validée par les organisateur⋅rices." -#: participation/models.py:404 +#: participation/models.py:454 msgid "The team is selected for the final tournament." msgstr "L'équipe est sélectionnée pour la finale." -#: participation/models.py:411 +#: participation/models.py:461 #, python-brace-format msgid "Participation of the team {name} ({trigram})" msgstr "Participation de l'équipe {name} ({trigram})" -#: participation/models.py:415 participation/models.py:448 +#: participation/models.py:465 participation/models.py:498 msgid "participations" msgstr "participations" -#: participation/models.py:430 participation/models.py:431 +#: participation/models.py:480 participation/models.py:481 #, python-brace-format msgid "Round {round}" msgstr "Tour {round}" -#: participation/models.py:454 +#: participation/models.py:504 msgid "juries" msgstr "jurys" -#: participation/models.py:461 +#: participation/models.py:511 msgid "BigBlueButton URL" msgstr "Lien BigBlueButton" -#: participation/models.py:462 +#: participation/models.py:512 msgid "The link of the BBB visio for this pool." msgstr "Le lien du salon BBB pour cette poule." -#: participation/models.py:467 +#: participation/models.py:517 msgid "results available" msgstr "résultats disponibles" -#: participation/models.py:468 +#: participation/models.py:518 msgid "" "Check this case when results become accessible to teams. They stay " "accessible to you. Only averages are given." @@ -786,28 +839,28 @@ msgstr "" "Ils restent toujours accessibles pour vous. Seules les moyennes sont " "communiquées." -#: participation/models.py:488 +#: participation/models.py:538 #, 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:508 +#: participation/models.py:558 msgid "position" msgstr "position" -#: participation/models.py:515 +#: participation/models.py:565 msgid "defended solution" msgstr "solution défendue" -#: participation/models.py:548 +#: participation/models.py:598 msgid "observer" msgstr "observateur⋅rice" -#: participation/models.py:553 +#: participation/models.py:603 msgid "penalties" msgstr "pénalités" -#: participation/models.py:555 +#: participation/models.py:605 msgid "" "Number of penalties for the defender. The defender will loose a 0.5 " "coefficient per penalty." @@ -815,124 +868,124 @@ msgstr "" "Nombre de pénalités pour l'équipe défenseuse. Elle perd un coefficient 0.5 " "sur sa présentation orale par pénalité." -#: participation/models.py:631 participation/models.py:634 -#: participation/models.py:637 participation/models.py:640 +#: participation/models.py:681 participation/models.py:684 +#: participation/models.py:687 participation/models.py:690 #, 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:645 +#: participation/models.py:695 #, python-brace-format msgid "Passage of {defender} for problem {problem}" msgstr "Passage de {defender} pour le problème {problem}" -#: participation/models.py:649 participation/models.py:658 -#: participation/models.py:739 participation/models.py:781 +#: participation/models.py:699 participation/models.py:708 +#: participation/models.py:789 participation/models.py:831 msgid "passage" msgstr "passage" -#: participation/models.py:650 +#: participation/models.py:700 msgid "passages" msgstr "passages" -#: participation/models.py:669 +#: participation/models.py:719 msgid "difference" msgstr "différence" -#: participation/models.py:670 +#: participation/models.py:720 msgid "Score to add/remove on the final score" msgstr "Score à ajouter/retrancher au score final" -#: participation/models.py:677 +#: participation/models.py:727 msgid "tweak" msgstr "harmonisation" -#: participation/models.py:678 +#: participation/models.py:728 msgid "tweaks" msgstr "harmonisations" -#: participation/models.py:706 +#: participation/models.py:756 msgid "solution for the final tournament" msgstr "solution pour la finale" -#: participation/models.py:711 participation/models.py:750 +#: participation/models.py:761 participation/models.py:800 msgid "file" msgstr "fichier" -#: participation/models.py:717 +#: participation/models.py:767 #, 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:719 +#: participation/models.py:769 msgid "for final" msgstr "pour la finale" -#: participation/models.py:722 +#: participation/models.py:772 msgid "solution" msgstr "solution" -#: participation/models.py:723 +#: participation/models.py:773 msgid "solutions" msgstr "solutions" -#: participation/models.py:756 +#: participation/models.py:806 #, 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:764 +#: participation/models.py:814 msgid "synthesis" msgstr "note de synthèse" -#: participation/models.py:765 +#: participation/models.py:815 msgid "syntheses" msgstr "notes de synthèse" -#: participation/models.py:774 +#: participation/models.py:824 msgid "jury" msgstr "jury" -#: participation/models.py:786 +#: participation/models.py:836 msgid "defender writing note" msgstr "note d'écrit de la défense" -#: participation/models.py:792 +#: participation/models.py:842 msgid "defender oral note" msgstr "note d'oral de la défense" -#: participation/models.py:798 +#: participation/models.py:848 msgid "opponent writing note" msgstr "note d'écrit de l'opposition" -#: participation/models.py:804 +#: participation/models.py:854 msgid "opponent oral note" msgstr "note d'oral de l'opposition" -#: participation/models.py:810 +#: participation/models.py:860 msgid "reporter writing note" msgstr "note d'écrit du rapportage" -#: participation/models.py:816 +#: participation/models.py:866 msgid "reporter oral note" msgstr "note d'oral du rapportage" -#: participation/models.py:822 +#: participation/models.py:872 msgid "observer note" msgstr "note de l'observation" -#: participation/models.py:851 +#: participation/models.py:901 #, python-brace-format msgid "Notes of {jury} for {passage}" msgstr "Notes de {jury} pour le {passage}" -#: participation/models.py:858 +#: participation/models.py:908 msgid "note" msgstr "note" -#: participation/models.py:859 +#: participation/models.py:909 msgid "notes" msgstr "notes" @@ -2224,8 +2277,8 @@ msgid "" "your scholarship attestation." msgstr "" "Le prix du tournoi est de %(price)s €. Les frais de participation sont " -"offerts pour les encadrant⋅es et les élèves boursièr⋅es. Si c'est le " -"cas, merci de nous transmettre votre notification de bourse." +"offerts pour les encadrant⋅es et les élèves boursièr⋅es. Si c'est le cas, " +"merci de nous transmettre votre notification de bourse." #: registration/templates/registration/payment_form.html:17 msgid "" @@ -2427,23 +2480,23 @@ msgid "Impersonate" msgstr "Impersonifier" #: registration/templates/registration/user_detail.html:188 -#: registration/views.py:312 +#: registration/views.py:313 msgid "Upload photo authorization" msgstr "Téléverser l'autorisation de droit à l'image" #: registration/templates/registration/user_detail.html:193 -#: registration/views.py:333 +#: registration/views.py:334 msgid "Upload health sheet" msgstr "Téléverser la fiche sanitaire" #: registration/templates/registration/user_detail.html:198 -#: registration/views.py:354 +#: registration/views.py:355 msgid "Upload vaccine sheet" msgstr "Téléverser le carnet de vaccination" #: registration/templates/registration/user_detail.html:203 #: registration/templates/registration/user_detail.html:208 -#: registration/views.py:375 +#: registration/views.py:376 msgid "Upload parental authorization" msgstr "Téléverser l'autorisation parentale" @@ -2476,32 +2529,32 @@ msgstr "Renvoyé le lien de validation de l'adresse mail" msgid "Detail of user {user}" msgstr "Détails de l'utilisateur⋅rice {user}" -#: registration/views.py:272 +#: registration/views.py:273 #, python-brace-format msgid "Update user {user}" msgstr "Mise à jour de l'utilisateur⋅rice {user}" -#: registration/views.py:487 +#: registration/views.py:488 #, python-brace-format msgid "Photo authorization of {student}.{ext}" msgstr "Autorisation de droit à l'image de {student}.{ext}" -#: registration/views.py:510 +#: registration/views.py:511 #, python-brace-format msgid "Health sheet of {student}.{ext}" msgstr "Fiche sanitaire de {student}.{ext}" -#: registration/views.py:533 +#: registration/views.py:534 #, python-brace-format msgid "Vaccine sheet of {student}.{ext}" msgstr "Carnet de vaccination de {student}.{ext}" -#: registration/views.py:556 +#: registration/views.py:557 #, python-brace-format msgid "Parental authorization of {student}.{ext}" msgstr "Autorisation parentale de {student}.{ext}" -#: registration/views.py:578 +#: registration/views.py:579 #, python-brace-format msgid "Scholarship attestation of {user}.{ext}" msgstr "Notification de bourse de {user}.{ext}" @@ -2664,6 +2717,6 @@ msgstr "Résultats" msgid "No results found." msgstr "Aucun résultat." -#: tfjm/templates/sidebar.html:6 +#: tfjm/templates/sidebar.html:10 tfjm/templates/sidebar.html:21 msgid "Informations" msgstr "Informations" diff --git a/participation/models.py b/participation/models.py index cf066fa..0bdba63 100644 --- a/participation/models.py +++ b/participation/models.py @@ -67,6 +67,8 @@ class Team(models.Model): return self.participants.filter(coachregistration__isnull=False) def can_validate(self): + if any(not r.email_confirmed for r in self.participants.all()): + return False if self.students.count() < 4: return False if not self.coaches.exists(): @@ -91,60 +93,108 @@ class Team(models.Model): if self.participation.valid is None: if not self.participation.tournament: - text = _("The team is not registered to any tournament. " + text = _("The team {trigram} is not registered to any tournament. " "You can register the team to a tournament using this link.") url = reverse_lazy("participation:update_team", args=(self.pk,)) - content = format_lazy(text, url=url) + content = format_lazy(text, trigram=self.trigram, url=url) informations.append({ 'title': _("No tournament"), 'type': "danger", 'priority': 4, 'content': content, }) - elif not self.motivation_letter: - text = _("The team has not uploaded a motivation letter. " - "You can upload your motivation letter using this link.") - url = reverse_lazy("participation:upload_team_motivation_letter", args=(self.pk,)) - content = format_lazy(text, url=url) + else: + text = _("Registrations for the tournament of {tournament} are ending on the {date:%Y-%m-%d %H:%M}.") + content = format_lazy(text, + tournament=self.participation.tournament.name, + date=self.participation.tournament.inscription_limit) informations.append({ - 'title': _("No motivation letter"), - 'type': "danger", - 'priority': 10, + 'title': _("Registrations closure"), + 'type': "info", + 'priority': 1, 'content': content, }) - if (nb_students := self.students.count()) < 4: - text = _("The team has less than 4 students ({nb_students})." - "You can invite more students to join the team using the invite code {code}.") - content = format_lazy(text, nb_students=nb_students, code=self.access_code) - informations.append({ - 'title': _("Not enough students"), - 'type': "warning", - 'priority': 7, - 'content': content, - }) + if not self.motivation_letter: + text = _("The team {trigram} has not uploaded a motivation letter. " + "You can upload your motivation letter using this link.") + url = reverse_lazy("participation:upload_team_motivation_letter", args=(self.pk,)) + content = format_lazy(text, trigram=self.trigram, url=url) + informations.append({ + 'title': _("No motivation letter"), + 'type': "danger", + 'priority': 10, + 'content': content, + }) - if not self.coaches.exists(): - text = _("The team has no coach." - "You can invite a coach to join the team using the invite code {code}.") - content = format_lazy(text, nb_students=nb_students, code=self.access_code) - informations.append({ - 'title': _("No coach"), - 'type': "warning", - 'priority': 8, - 'content': content, - }) + nb_students = self.students.count() + nb_coaches = self.coaches.count() + if nb_students < 4: + text = _("The team {trigram} has less than 4 students ({nb_students}). " + "You can invite more students to join the team using " + "the invite code {code}.") + content = format_lazy(text, trigram=self.trigram, nb_students=nb_students, code=self.access_code) + informations.append({ + 'title': _("Not enough students"), + 'type': "warning", + 'priority': 7, + 'content': content, + }) - if (nb_students := self.students.count()) > 6 or self.coaches.count() > 2: - text = _("The team has more than 6 students ({nb_students}) or more than 2 coaches ({nb_coaches})." - "You have to restrict the number of students and coaches to 6 and 2, respectively.") - content = format_lazy(text, nb_students=nb_students, nb_coaches=self.coaches.count()) - informations.append({ - 'title': _("Too many members"), - 'type': "warning", - 'priority': 7, - 'content': content, - }) + if not nb_coaches: + text = _("The team {trigram} has no coach. " + "You can invite a coach to join the team using the invite code {code}.") + content = format_lazy(text, trigram=self.trigram, nb_students=nb_students, code=self.access_code) + informations.append({ + 'title': _("No coach"), + 'type': "warning", + 'priority': 8, + 'content': content, + }) + + if nb_students > 6 or nb_coaches > 2: + text = _("The team {trigram} has more than 6 students ({nb_students}) " + "or more than 2 coaches ({nb_coaches})." + "You have to restrict the number of students and coaches to 6 and 2, respectively.") + content = format_lazy(text, trigram=self.trigram, nb_students=nb_students, nb_coaches=nb_coaches) + informations.append({ + 'title': _("Too many members"), + 'type': "warning", + 'priority': 7, + 'content': content, + }) + elif nb_students >= 4 and nb_coaches >= 1: + if self.can_validate(): + text = _("The team {trigram} is ready to be validated. " + "You can request validation on the page of your team.") + url = reverse_lazy("participation:team_detail", args=(self.pk,)) + content = format_lazy(text, trigram=self.trigram, url=url) + informations.append({ + 'title': _("Validate team"), + 'type': "success", + 'priority': 2, + 'content': content, + }) + else: + text = _("The team {trigram} has enough participants, but is not ready to be validated. " + "Please make sure that all the participants have uploaded the required documents. " + "To invite more participants, use the invite code {code}.") + content = format_lazy(text, trigram=self.trigram, code=self.access_code) + informations.append({ + 'title': _("Validate team"), + 'type': "warning", + 'priority': 10, + 'content': content, + }) + elif self.participation.valid is False: + text = _("The team {trigram} has not been validated by the organizers yet. Please be patient.") + content = format_lazy(text, trigram=self.trigram) + informations.append({ + 'title': _("Pending validation"), + 'type': "warning", + 'priority': 2, + 'content': content, + }) return informations