Fix: export Apogée: traitement erreur étudiants sans NIP

This commit is contained in:
Emmanuel Viennet 2024-07-12 17:18:26 +02:00
parent 810fa8e9f8
commit 72fe741f62

View File

@ -545,7 +545,8 @@ def view_scodoc_etuds(semset_id, title="", nip_list="", fmt="html"):
if not isinstance(nip_list, str): if not isinstance(nip_list, str):
nip_list = str(nip_list) nip_list = str(nip_list)
nips = nip_list.split(",") nips = nip_list.split(",")
etuds = [sco_etud.get_etud_info(code_nip=nip, filled=True)[0] for nip in nips] etuds_lst = [sco_etud.get_etud_info(code_nip=nip, filled=True) for nip in nips]
etuds = [lst[0] for lst in etuds_lst if lst]
for e in etuds: for e in etuds:
tgt = url_for( tgt = url_for(
@ -778,12 +779,18 @@ def view_apo_csv(etape_apo="", semset_id="", fmt="html"):
e["in_scodoc"] = e["nip"] not in nips_no_sco e["in_scodoc"] = e["nip"] not in nips_no_sco
e["in_scodoc_str"] = {True: "oui", False: "non"}[e["in_scodoc"]] e["in_scodoc_str"] = {True: "oui", False: "non"}[e["in_scodoc"]]
if e["in_scodoc"]: if e["in_scodoc"]:
e.update(sco_etud.get_etud_info(code_nip=e["nip"], filled=True)[0]) etud = sco_etud.get_etud_info(code_nip=e["nip"], filled=True)
e["_in_scodoc_str_target"] = url_for( if etud:
"scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=e["etudid"] e.update(etud[0])
) e["_in_scodoc_str_target"] = url_for(
e["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"],) "scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=e["etudid"]
e["_prenom_td_attrs"] = 'id="pre-%s" class="etudinfo"' % (e["etudid"],) )
e["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"],)
e["_prenom_td_attrs"] = 'id="pre-%s" class="etudinfo"' % (e["etudid"],)
else:
# race condition?
e["in_scodoc"] = False
e["_css_row_class"] = "apo_not_scodoc"
else: else:
e["_css_row_class"] = "apo_not_scodoc" e["_css_row_class"] = "apo_not_scodoc"