From 0402eac989942c0ce8d4d038b4a6beca208f240b Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 23 Jun 2023 17:51:17 +0200 Subject: [PATCH] Fix #582: moy UE fiche etud si dispense. --- app/scodoc/sco_formsemestre_validation.py | 39 +++++++++++++++-------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index 15254a0e..c087ff2b 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -512,7 +512,7 @@ def decisions_possible_rows(Se, assiduite, subtitle="", trclass=""): def formsemestre_recap_parcours_table( - Se, + situation_etud_cursus: sco_cursus_dut.SituationEtudCursus, etudid, with_links=False, with_all_columns=True, @@ -550,16 +550,18 @@ def formsemestre_recap_parcours_table( """ ) # titres des UE - H.append("" * Se.nb_max_ue) + H.append("" * situation_etud_cursus.nb_max_ue) # if with_links: H.append("") H.append("") num_sem = 0 - for sem in Se.get_semestres(): - is_prev = Se.prev and (Se.prev["formsemestre_id"] == sem["formsemestre_id"]) - is_cur = Se.formsemestre_id == sem["formsemestre_id"] + for sem in situation_etud_cursus.get_semestres(): + is_prev = situation_etud_cursus.prev and ( + situation_etud_cursus.prev["formsemestre_id"] == sem["formsemestre_id"] + ) + is_cur = situation_etud_cursus.formsemestre_id == sem["formsemestre_id"] num_sem += 1 dpv = sco_pv_dict.dict_pvjury(sem["formsemestre_id"], etudids=[etudid]) @@ -582,7 +584,7 @@ def formsemestre_recap_parcours_table( else: type_sem = "" class_sem = "sem_autre" - if sem["formation_code"] != Se.formation.formation_code: + if sem["formation_code"] != situation_etud_cursus.formation.formation_code: class_sem += " sem_autre_formation" if sem["bul_bgcolor"]: bgcolor = sem["bul_bgcolor"] @@ -646,7 +648,7 @@ def formsemestre_recap_parcours_table( H.append("en cours") H.append(f"""{ass}""") # abs # acronymes UEs auxquelles l'étudiant est inscrit (ou capitalisé) - ues = list(nt.etud_ues(etudid)) + ues = list(nt.etud_ues(etudid)) # nb: en BUT, les UE "dispensées" sont incluses cnx = ndb.GetDBConnexion() etud_ue_status = {ue.id: nt.get_etud_ue_status(etudid, ue.id) for ue in ues} if not nt.is_apc: @@ -660,8 +662,10 @@ def formsemestre_recap_parcours_table( for ue in ues: H.append(f"""{ue.acronyme}""") - if len(ues) < Se.nb_max_ue: - H.append(f"""""") + if len(ues) < situation_etud_cursus.nb_max_ue: + H.append( + f"""""" + ) # indique le semestre compensé par celui ci: if decision_sem and decision_sem["compense_formsemestre_id"]: csem = sco_formsemestre.get_formsemestre( @@ -686,7 +690,7 @@ def formsemestre_recap_parcours_table( if not sem["etat"]: # locked lockicon = scu.icontag("lock32_img", title="verrouillé", border="0") default_sem_info += lockicon - if sem["formation_code"] != Se.formation.formation_code: + if sem["formation_code"] != situation_etud_cursus.formation.formation_code: default_sem_info += f"""Autre formation: {sem["formation_code"]}""" H.append( '%s%s' @@ -723,14 +727,21 @@ def formsemestre_recap_parcours_table( explanation_ue.append( f"""Capitalisée le {ue_status["event_date"] or "?"}.""" ) - + # Dispense BUT ? + if (etudid, ue.id) in nt.dispense_ues: + moy_ue_txt = "❎" if (ue_status and ue_status["is_capitalized"]) else "⭕" + explanation_ue.append("non inscrit (dispense)") + else: + moy_ue_txt = scu.fmt_note(moy_ue) H.append( f"""{scu.fmt_note(moy_ue)}""" + }">{moy_ue_txt}""" + ) + if len(ues) < situation_etud_cursus.nb_max_ue: + H.append( + f"""""" ) - if len(ues) < Se.nb_max_ue: - H.append(f"""""") H.append("") if with_links: