From 72fe741f6230168d455530d77cbf33340f1b849f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 12 Jul 2024 17:18:26 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20export=20Apog=C3=A9e:=20traitement=20err?= =?UTF-8?q?eur=20=20=C3=A9tudiants=20sans=20NIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_etape_apogee_view.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/scodoc/sco_etape_apogee_view.py b/app/scodoc/sco_etape_apogee_view.py index 9e461199..5845013b 100644 --- a/app/scodoc/sco_etape_apogee_view.py +++ b/app/scodoc/sco_etape_apogee_view.py @@ -545,7 +545,8 @@ def view_scodoc_etuds(semset_id, title="", nip_list="", fmt="html"): if not isinstance(nip_list, str): nip_list = str(nip_list) 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: 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_str"] = {True: "oui", False: "non"}[e["in_scodoc"]] if e["in_scodoc"]: - e.update(sco_etud.get_etud_info(code_nip=e["nip"], filled=True)[0]) - e["_in_scodoc_str_target"] = url_for( - "scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=e["etudid"] - ) - e["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"],) - e["_prenom_td_attrs"] = 'id="pre-%s" class="etudinfo"' % (e["etudid"],) + etud = sco_etud.get_etud_info(code_nip=e["nip"], filled=True) + if etud: + e.update(etud[0]) + e["_in_scodoc_str_target"] = url_for( + "scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=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: e["_css_row_class"] = "apo_not_scodoc"