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

View File

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