From 53dc7e7529da443e33fa2a166f10244d9f0dba93 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 11 Feb 2022 08:52:09 +0100 Subject: [PATCH] 3 petits correctifs (bulletins anciens) --- app/but/bulletin_but_xml_compat.py | 2 +- app/scodoc/sco_bulletins_json.py | 5 ++++- app/scodoc/sco_bulletins_xml.py | 5 ++++- app/scodoc/sco_utils.py | 5 ++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/but/bulletin_but_xml_compat.py b/app/but/bulletin_but_xml_compat.py index 69b8f568..db2b18c1 100644 --- a/app/but/bulletin_but_xml_compat.py +++ b/app/but/bulletin_but_xml_compat.py @@ -175,7 +175,7 @@ def bulletin_but_xml_compat( x_ue.append(Element("rang", value=str(rang_ue))) x_ue.append(Element("effectif", value=str(nb_inscrits_ue))) # Liste les modules rattachés à cette UE - for modimpl in results.modimpls: + for modimpl in results.formsemestre.modimpls: # Liste ici uniquement les modules rattachés à cette UE if modimpl.module.ue.id == ue.id: # mod_moy = scu.fmt_note(results.etud_moy_ue[ue.id][etud.id]) diff --git a/app/scodoc/sco_bulletins_json.py b/app/scodoc/sco_bulletins_json.py index f25cdfcf..dbf4a8dc 100644 --- a/app/scodoc/sco_bulletins_json.py +++ b/app/scodoc/sco_bulletins_json.py @@ -254,7 +254,10 @@ def formsemestre_bulletinetud_published_dict( m["note"][k] = scu.fmt_note(m["note"][k]) u["module"].append(m) - if sco_preferences.get_preference("bul_show_mod_rangs", formsemestre_id): + if ( + sco_preferences.get_preference("bul_show_mod_rangs", formsemestre_id) + and nt.mod_rangs is not None + ): m["rang"] = dict( value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid] ) diff --git a/app/scodoc/sco_bulletins_xml.py b/app/scodoc/sco_bulletins_xml.py index fda6869c..8133501b 100644 --- a/app/scodoc/sco_bulletins_xml.py +++ b/app/scodoc/sco_bulletins_xml.py @@ -271,7 +271,10 @@ def make_xml_formsemestre_bulletinetud( moy=scu.fmt_note(modstat["moy"]), ) ) - if sco_preferences.get_preference("bul_show_mod_rangs", formsemestre_id): + if ( + sco_preferences.get_preference("bul_show_mod_rangs", formsemestre_id) + and nt.mod_rangs is not None + ): x_mod.append( Element( "rang", diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index 360eee97..1cc6e89c 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -227,7 +227,10 @@ def get_mention(moy): moy = float(moy) except: return "" - return NOTES_MENTIONS_LABS[bisect.bisect_right(NOTES_MENTIONS_TH, moy)] + if moy > 0.0: + return NOTES_MENTIONS_LABS[bisect.bisect_right(NOTES_MENTIONS_TH, moy)] + else: + return "" class DictDefault(dict): # obsolete, use collections.defaultdict