From 7a183185a2c80c9e75915d94846784abb1a43e2a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 8 Feb 2022 23:58:02 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20codes=20Apog=C3=A9e=20nulls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/modules.py | 1 + app/models/ues.py | 1 + app/scodoc/sco_apogee_csv.py | 12 ++++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/models/modules.py b/app/models/modules.py index ac82b127..393cc8c0 100644 --- a/app/models/modules.py +++ b/app/models/modules.py @@ -63,6 +63,7 @@ class Module(db.Model): e["numero"] = 0 if self.numero is None else self.numero e["coefficient"] = 0.0 if self.coefficient is None else self.coefficient e["module_type"] = 0 if self.module_type is None else self.module_type + e["code_apogee"] = e["code_apogee"] or "" # pas de None return e def is_apc(self): diff --git a/app/models/ues.py b/app/models/ues.py index 3497414c..09469fb0 100644 --- a/app/models/ues.py +++ b/app/models/ues.py @@ -62,6 +62,7 @@ class UniteEns(db.Model): e["numero"] = e["numero"] if e["numero"] else 0 e["ects"] = e["ects"] if e["ects"] else 0.0 e["coefficient"] = e["coefficient"] if e["coefficient"] else 0.0 + e["code_apogee"] = e["code_apogee"] or "" # pas de None return e def is_locked(self): diff --git a/app/scodoc/sco_apogee_csv.py b/app/scodoc/sco_apogee_csv.py index 04a2fe2c..4cae1772 100644 --- a/app/scodoc/sco_apogee_csv.py +++ b/app/scodoc/sco_apogee_csv.py @@ -413,7 +413,7 @@ class ApoEtud(dict): # Elements UE decisions_ue = nt.get_etud_decision_ues(etudid) for ue in nt.get_ues_stat_dict(): - if code in ue["code_apogee"].split(","): + if ue["code_apogee"] and code in ue["code_apogee"].split(","): if self.export_res_ues: if decisions_ue and ue["ue_id"] in decisions_ue: ue_status = nt.get_etud_ue_status(etudid, ue["ue_id"]) @@ -434,7 +434,9 @@ class ApoEtud(dict): modimpls = nt.get_modimpls_dict() module_code_found = False for modimpl in modimpls: - if code in modimpl["module"]["code_apogee"].split(","): + if modimpl["module"]["code_apogee"] and code in modimpl["module"][ + "code_apogee" + ].split(","): n = nt.get_etud_mod_moy(modimpl["moduleimpl_id"], etudid) if n != "NI" and self.export_res_modules: return dict(N=_apo_fmt_note(n), B=20, J="", R="") @@ -947,13 +949,15 @@ class ApoData(object): # associé à une UE: nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"]) for ue in nt.get_ues_stat_dict(): - if code in ue["code_apogee"].split(","): + if ue["code_apogee"] and code in ue["code_apogee"].split(","): s.add(code) continue # associé à un module: modimpls = nt.get_modimpls_dict() for modimpl in modimpls: - if code in modimpl["module"]["code_apogee"].split(","): + if modimpl["module"]["code_apogee"] and code in modimpl["module"][ + "code_apogee" + ].split(","): s.add(code) continue # log('codes_by_sem=%s' % pprint.pformat(codes_by_sem))