From 958539977a92d2af1a86e249f19d18bf71404aed Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 3 Dec 2021 15:44:57 +0100 Subject: [PATCH] modif export json (retours Seb) --- app/models/but_refcomp.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/but_refcomp.py b/app/models/but_refcomp.py index 50fbf1e92..b930bf9e5 100644 --- a/app/models/but_refcomp.py +++ b/app/models/but_refcomp.py @@ -56,6 +56,7 @@ class ApcReferentielCompetences(db.Model, XMLModel): lazy="dynamic", cascade="all, delete-orphan", ) + formations = db.relationship("Formation", backref="referentiel_competence") def to_dict(self): """Représentation complète du ref. de comp. @@ -66,7 +67,9 @@ class ApcReferentielCompetences(db.Model, XMLModel): "specialite": self.specialite, "specialite_long": self.specialite_long, "type_titre": self.type_titre, - "scodoc_date_loaded": self.scodoc_date_loaded.isoformat() + "Z", + "scodoc_date_loaded": self.scodoc_date_loaded.isoformat() + "Z" + if self.scodoc_date_loaded + else "", "scodoc_orig_filename": self.scodoc_orig_filename, "competences": {x.titre: x.to_dict() for x in self.competences}, "parcours": {x.code: x.to_dict() for x in self.parcours}, @@ -188,7 +191,7 @@ class ApcAppCritique(db.Model, XMLModel): ) def to_dict(self): - return {"code": self.code, "libelle": self.libelle} + return {"libelle": self.libelle} def get_label(self): return self.code + " - " + self.titre @@ -243,7 +246,7 @@ class ApcAnneeParcours(db.Model, XMLModel): return { "ordre": self.ordre, "competences": { - x.competence.titre: {"niveau": x.niveau, "titre": x.competence.titre} + x.competence.titre: {"niveau": x.niveau} for x in self.niveaux_competences }, }