Export Apogée: n'exporte rien sur les UEs dispensées. Closes #626

This commit is contained in:
Emmanuel Viennet 2024-06-24 02:07:34 +02:00
parent 08dfaeb436
commit a2f07cea64

View File

@ -327,34 +327,9 @@ class ApoEtud(dict):
return VOID_APO_RES
# Elements UE
decisions_ue = res.get_etud_decisions_ue(etudid)
for ue in res.get_ues_stat_dict():
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
) or self.export_res_sdj:
ue_status = res.get_etud_ue_status(etudid, ue["ue_id"])
if decisions_ue and ue["ue_id"] in decisions_ue:
code_decision_ue = decisions_ue[ue["ue_id"]]["code"]
code_decision_ue_apo = ScoDocSiteConfig.get_code_apo(
code_decision_ue
)
else:
code_decision_ue_apo = ""
return dict(
N=self.fmt_note(ue_status["moy"] if ue_status else ""),
B=20,
J="",
R=code_decision_ue_apo,
M="",
)
else:
return VOID_APO_RES
else:
return VOID_APO_RES
res_ue = self.search_elt_ue(code, res)
if res_ue != {}:
return res_ue
# Elements Modules
modimpls = res.get_modimpls_dict()
@ -391,6 +366,43 @@ class ApoEtud(dict):
#
return None # element Apogee non trouvé dans ce semestre
def search_elt_ue(self, code: str, res: NotesTableCompat) -> dict:
"""Cherche un résultat d'UE pour ce code Apogée.
dict vide si pas de résultat trouvé pour ce code.
"""
decisions_ue = res.get_etud_decisions_ue(self.etud.id)
for ue in res.get_ues_stat_dict():
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
) or self.export_res_sdj:
# Si dispensé de cette UE, n'exporte rien
if (self.etud.id, ue["ue_id"]) in res.dispense_ues:
return VOID_APO_RES
ue_status = res.get_etud_ue_status(self.etud.id, ue["ue_id"])
if decisions_ue and ue["ue_id"] in decisions_ue:
code_decision_ue = decisions_ue[ue["ue_id"]]["code"]
code_decision_ue_apo = ScoDocSiteConfig.get_code_apo(
code_decision_ue
)
else:
code_decision_ue_apo = ""
return dict(
N=self.fmt_note(ue_status["moy"] if ue_status else ""),
B=20,
J="",
R=code_decision_ue_apo,
M="",
)
else:
return VOID_APO_RES
else:
return VOID_APO_RES
return {} # no UE result found for this code
def comp_elt_semestre(self, nt: NotesTableCompat, decision: dict, etudid: int):
"""Calcul résultat apo semestre.
Toujours vide pour en BUT/APC.