Fix: code apo multiples par modules et UE

This commit is contained in:
Emmanuel Viennet 2022-04-22 14:35:44 +02:00
parent 7ab130499b
commit 7f80b18990
2 changed files with 26 additions and 19 deletions

View File

@ -396,7 +396,7 @@ class ApoEtud(dict):
# Element etape (annuel ou non):
if sco_formsemestre.sem_has_etape(sem, code) or (
code in sem["elt_annee_apo"].split(",")
code in {x.strip() for x in sem["elt_annee_apo"].split(",")}
):
export_res_etape = self.export_res_etape
if (not export_res_etape) and cur_sem:
@ -412,7 +412,7 @@ class ApoEtud(dict):
return VOID_APO_RES
# Element semestre:
if code in sem["elt_sem_apo"].split(","):
if code in {x.strip() for x in sem["elt_sem_apo"].split(",")}:
if self.export_res_sem:
return self.comp_elt_semestre(nt, decision, etudid)
else:
@ -421,7 +421,9 @@ class ApoEtud(dict):
# Elements UE
decisions_ue = nt.get_etud_decision_ues(etudid)
for ue in nt.get_ues_stat_dict():
if ue["code_apogee"] and code in ue["code_apogee"].split(","):
if ue["code_apogee"] and code in {
x.strip() for x 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"])
@ -442,9 +444,10 @@ class ApoEtud(dict):
modimpls = nt.get_modimpls_dict()
module_code_found = False
for modimpl in modimpls:
if modimpl["module"]["code_apogee"] and code in modimpl["module"][
"code_apogee"
].split(","):
module = modimpl["module"]
if module["code_apogee"] and code in {
x.strip() for x in 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=self.fmt_note(n), B=20, J="", R="")
@ -949,8 +952,9 @@ class ApoData(object):
return maq_elems, sem_elems
def get_codes_by_sem(self):
"""Pour chaque semestre associé, donne l'ensemble des codes Apogée qui s'y trouvent
(dans le semestre, les UE et les modules)
"""Pour chaque semestre associé, donne l'ensemble des codes de cette maquette Apogée
qui s'y trouvent (dans le semestre, les UE ou les modules).
Return: { formsemestre_id : { 'code1', 'code2', ... }}
"""
codes_by_sem = {}
for sem in self.sems_etape:
@ -961,8 +965,8 @@ class ApoData(object):
# associé à l'étape, l'année ou les semestre:
if (
sco_formsemestre.sem_has_etape(sem, code)
or (code in sem["elt_sem_apo"].split(","))
or (code in sem["elt_annee_apo"].split(","))
or (code in {x.strip() for x in sem["elt_sem_apo"].split(",")})
or (code in {x.strip() for x in sem["elt_annee_apo"].split(",")})
):
s.add(code)
continue
@ -970,17 +974,20 @@ class ApoData(object):
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
for ue in nt.get_ues_stat_dict():
if ue["code_apogee"] and code in ue["code_apogee"].split(","):
s.add(code)
continue
if ue["code_apogee"]:
codes = {x.strip() for x in ue["code_apogee"].split(",")}
if code in codes:
s.add(code)
continue
# associé à un module:
modimpls = nt.get_modimpls_dict()
for modimpl in modimpls:
if modimpl["module"]["code_apogee"] and code in modimpl["module"][
"code_apogee"
].split(","):
s.add(code)
continue
module = modimpl["module"]
if module["code_apogee"]:
codes = {x.strip() for x in module["code_apogee"].split(",")}
if code in codes:
s.add(code)
continue
# log('codes_by_sem=%s' % pprint.pformat(codes_by_sem))
return codes_by_sem

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.2.10"
SCOVERSION = "9.2.11"
SCONAME = "ScoDoc"