Fix #582: moy UE fiche etud si dispense.

This commit is contained in:
Emmanuel Viennet 2023-06-23 17:51:17 +02:00 committed by iziram
parent 4dc2b41402
commit 0402eac989

View File

@ -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("<th></th>" * Se.nb_max_ue)
H.append("<th></th>" * situation_etud_cursus.nb_max_ue)
#
if with_links:
H.append("<th></th>")
H.append("<th></th></tr>")
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("<td><em>en cours</em></td>")
H.append(f"""<td class="rcp_nonass">{ass}</td>""") # 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"""<td class="ue_acro"><span>{ue.acronyme}</span></td>""")
if len(ues) < Se.nb_max_ue:
H.append(f"""<td colspan="{Se.nb_max_ue - len(ues)}"></td>""")
if len(ues) < situation_etud_cursus.nb_max_ue:
H.append(
f"""<td colspan="{situation_etud_cursus.nb_max_ue - len(ues)}"></td>"""
)
# 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(
'<td class="datefin">%s</td><td class="sem_info">%s</td>'
@ -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"""<td class="{class_ue}" title="{
" ".join(explanation_ue)
}">{scu.fmt_note(moy_ue)}</td>"""
}">{moy_ue_txt}</td>"""
)
if len(ues) < situation_etud_cursus.nb_max_ue:
H.append(
f"""<td colspan="{situation_etud_cursus.nb_max_ue - len(ues)}"></td>"""
)
if len(ues) < Se.nb_max_ue:
H.append(f"""<td colspan="{Se.nb_max_ue - len(ues)}"></td>""")
H.append("<td></td>")
if with_links: