From 797686cf6cc1cb0c990da0c904c5395334e162b7 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 23 Jan 2023 15:08:00 -0300 Subject: [PATCH] =?UTF-8?q?Fix=20#571=20cursus=20BUT=20avec=20validation?= =?UTF-8?q?=20ant=C3=A9rieure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/cursus_but.py | 2 +- app/models/but_validations.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/but/cursus_but.py b/app/but/cursus_but.py index 2e18d955..bc72ae86 100644 --- a/app/but/cursus_but.py +++ b/app/but/cursus_but.py @@ -142,7 +142,7 @@ class EtudCursusBUT: self.validation_par_competence_et_annee[niveau.competence.id] = {} previous_validation = self.validation_par_competence_et_annee.get( niveau.competence.id - ) + ).get(validation_rcue.annee()) # prend la "meilleure" validation if (not previous_validation) or ( sco_codes.BUT_CODES_ORDERED[validation_rcue.code] diff --git a/app/models/but_validations.py b/app/models/but_validations.py index 0f3e239e..ccef89cd 100644 --- a/app/models/but_validations.py +++ b/app/models/but_validations.py @@ -71,6 +71,11 @@ class ApcValidationRCUE(db.Model): enregistrée le {self.date.strftime("%d/%m/%Y")} à {self.date.strftime("%Hh%M")}""" + def annee(self) -> str: + """l'année BUT concernée: "BUT1", "BUT2" ou "BUT3" """ + niveau = self.niveau() + return niveau.annee if niveau else None + def niveau(self) -> ApcNiveau: """Le niveau de compétence associé à cet RCUE.""" # Par convention, il est donné par la seconde UE