formsemestre_description: pas de ligne UE en APC

This commit is contained in:
Emmanuel Viennet 2023-05-12 16:55:30 +02:00
parent 78f0a70b94
commit f2a9e3fd5c

View File

@ -646,16 +646,23 @@ def formsemestre_description_table(
ects_str = ue.ects ects_str = ue.ects
ue_info = { ue_info = {
"UE": ue.acronyme, "UE": ue.acronyme,
"Code": "",
"ects": ects_str, "ects": ects_str,
"Module": ue.titre, "Module": ue.titre,
"_css_row_class": "table_row_ue", "_css_row_class": "table_row_ue",
"_UE_td_attrs": f'style="background-color: {ue.color} !important;"'
if ue.color
else "",
} }
if use_ue_coefs: if use_ue_coefs:
ue_info["Coef."] = ue.coefficient ue_info["Coef."] = ue.coefficient
ue_info["Coef._class"] = "ue_coef" ue_info["Coef._class"] = "ue_coef"
if ue.color:
for k in list(ue_info.keys()):
if not k.startswith("_"):
ue_info[
f"_{k}_td_attrs"
] = f'style="background-color: {ue.color} !important;"'
if not formsemestre.formation.is_apc():
# n'affiche la ligne UE qu'en formation classique
# car l'UE de rattachement n'a pas d'intérêt en BUT
rows.append(ue_info) rows.append(ue_info)
mod_inscrits = sco_moduleimpl.do_moduleimpl_inscription_list( mod_inscrits = sco_moduleimpl.do_moduleimpl_inscription_list(
@ -663,9 +670,9 @@ def formsemestre_description_table(
) )
enseignants = ", ".join(ens.get_prenomnom() for ens in modimpl.enseignants) enseignants = ", ".join(ens.get_prenomnom() for ens in modimpl.enseignants)
l = { row = {
"UE": modimpl.module.ue.acronyme, "UE": modimpl.module.ue.acronyme,
"_UE_td_attrs": ue_info["_UE_td_attrs"], "_UE_td_attrs": ue_info.get("_UE_td_attrs", ""),
"Code": modimpl.module.code or "", "Code": modimpl.module.code or "",
"Module": modimpl.module.abbrev or modimpl.module.titre, "Module": modimpl.module.abbrev or modimpl.module.titre,
"_Module_class": "scotext", "_Module_class": "scotext",
@ -692,13 +699,13 @@ def formsemestre_description_table(
sum_coef += modimpl.module.coefficient sum_coef += modimpl.module.coefficient
coef_dict = modimpl.module.get_ue_coef_dict() coef_dict = modimpl.module.get_ue_coef_dict()
for ue in ues: for ue in ues:
l[f"ue_{ue.id}"] = coef_dict.get(ue.id, 0.0) or "" row[f"ue_{ue.id}"] = coef_dict.get(ue.id, 0.0) or ""
if with_parcours: if with_parcours:
l["parcours"] = ", ".join( row["parcours"] = ", ".join(
sorted([pa.code for pa in modimpl.module.parcours]) sorted([pa.code for pa in modimpl.module.parcours])
) )
rows.append(l) rows.append(row)
if with_evals: if with_evals:
# Ajoute lignes pour evaluations # Ajoute lignes pour evaluations
@ -715,9 +722,9 @@ def formsemestre_description_table(
) )
e["_jour_order"] = e["jour"].isoformat() e["_jour_order"] = e["jour"].isoformat()
e["jour"] = e["jour"].strftime("%d/%m/%Y") if e["jour"] else "" e["jour"] = e["jour"].strftime("%d/%m/%Y") if e["jour"] else ""
e["UE"] = l["UE"] e["UE"] = row["UE"]
e["_UE_td_attrs"] = l["_UE_td_attrs"] e["_UE_td_attrs"] = row["_UE_td_attrs"]
e["Code"] = l["Code"] e["Code"] = row["Code"]
e["_css_row_class"] = "evaluation" e["_css_row_class"] = "evaluation"
e["Module"] = "éval." e["Module"] = "éval."
# Cosmetic: conversions pour affichage # Cosmetic: conversions pour affichage