From 02bccb58aaab96173f0f18e77e6eec43f823eb69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9o=20BARAS=20=28IUT1=20Grenoble=29?= Date: Fri, 26 Jan 2024 07:13:09 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liore=20le=20calcul=20de=20l'ann=C3=A9e?= =?UTF-8?q?=20de=20dipl=C3=B4me=20d'un=20=C3=A9tudiant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pe/pe_etudiant.py | 15 ++++++++++----- app/pe/pe_jury.py | 7 ++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/pe/pe_etudiant.py b/app/pe/pe_etudiant.py index 126f112f1..9e79e8d60 100644 --- a/app/pe/pe_etudiant.py +++ b/app/pe/pe_etudiant.py @@ -417,14 +417,19 @@ def annee_diplome(identite: Identite) -> int: Returns: L'année prévue de sa diplômation - - NOTE: Pourrait être déplacé dans app.models.etudiants.Identite """ formsemestres = identite.get_formsemestres() + if formsemestres: - return max( - [pe_comp.get_annee_diplome_semestre(sem_base) for sem_base in formsemestres] - ) + dates_possibles_diplome = [] + for sem_base in formsemestres: + annee = pe_comp.get_annee_diplome_semestre(sem_base) + if annee: + dates_possibles_diplome(annee) + if dates_possibles_diplome: + return max(dates_possibles_diplome) + else: + None else: return None diff --git a/app/pe/pe_jury.py b/app/pe/pe_jury.py index 790b10f82..6873a5be1 100644 --- a/app/pe/pe_jury.py +++ b/app/pe/pe_jury.py @@ -266,13 +266,18 @@ class JuryPE(object): cursus = self.etudiants.cursus[etudid] formsemestres = cursus["formsemestres"] + if cursus["diplome"]: + diplome = cursus["diplome"] + else: + diplome = "indéterminé" + administratif[etudid] = { "Nom": etudiant.nom, "Prenom": etudiant.prenom, "Civilite": etudiant.civilite_str, "Age": pe_comp.calcul_age(etudiant.date_naissance), "Date d'entree": cursus["entree"], - "Date de diplome": cursus["diplome"], + "Date de diplome": diplome, "Nbre de semestres": len(formsemestres), }