From 0573081711420e7b19e16c9e9d4ea4fefcb60266 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 18 Jul 2023 16:41:02 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20enregistrement=20des=20RCUEs=20ant=C3=A9?= =?UTF-8?q?rieurs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/jury.py | 23 +++++++++-------------- app/models/but_validations.py | 4 ++++ app/scodoc/sco_page_etud.py | 2 +- app/templates/but/validation_rcues.j2 | 1 + sco_version.py | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/api/jury.py b/app/api/jury.py index 450edde7de..d3a1d14584 100644 --- a/app/api/jury.py +++ b/app/api/jury.py @@ -269,13 +269,7 @@ def validation_rcue_record(etudid: int): validation.parcours_id = parcours_id validation.ue1_id = ue1_id validation.ue2_id = ue2_id - log(f"updating {validation}") - Scolog.logdb( - method="validation_rcue_record", - etudid=etudid, - msg=f"Mise à jour {validation}", - commit=False, - ) + operation = "update" else: validation = ApcValidationRCUE( code=code, @@ -286,15 +280,16 @@ def validation_rcue_record(etudid: int): ue1_id=ue1_id, ue2_id=ue2_id, ) - log(f"recording {validation}") - Scolog.logdb( - method="validation_rcue_record", - etudid=etudid, - msg=f"Enregistrement {validation}", - commit=False, - ) + operation = "record" db.session.add(validation) db.session.commit() + Scolog.logdb( + method="validation_rcue_record", + etudid=etudid, + msg=f"Enregistrement {validation}", + commit=True, + ) + log(f"{operation} {validation}") return validation.to_dict() diff --git a/app/models/but_validations.py b/app/models/but_validations.py index 185ab53987..6a3939a642 100644 --- a/app/models/but_validations.py +++ b/app/models/but_validations.py @@ -82,6 +82,10 @@ class ApcValidationRCUE(db.Model): "as a dict" d = dict(self.__dict__) d.pop("_sa_instance_state", None) + d["etud"] = self.etud.to_dict_short() + d["ue1"] = self.ue1.to_dict() + d["ue2"] = self.ue2.to_dict() + return d def to_dict_bul(self) -> dict: diff --git a/app/scodoc/sco_page_etud.py b/app/scodoc/sco_page_etud.py index 7058b34153..403b894722 100644 --- a/app/scodoc/sco_page_etud.py +++ b/app/scodoc/sco_page_etud.py @@ -517,7 +517,7 @@ def ficheEtud(etudid=None): cursus=but_cursus, scu=scu, )} -
+