From f2a9e3fd5ca1bde6043aacf4cfc1d15f691771b3 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 12 May 2023 16:55:30 +0200 Subject: [PATCH] formsemestre_description: pas de ligne UE en APC --- app/scodoc/sco_formsemestre_status.py | 31 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index b4716a00a..f971171c0 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -646,26 +646,33 @@ def formsemestre_description_table( ects_str = ue.ects ue_info = { "UE": ue.acronyme, + "Code": "", "ects": ects_str, "Module": ue.titre, "_css_row_class": "table_row_ue", - "_UE_td_attrs": f'style="background-color: {ue.color} !important;"' - if ue.color - else "", } if use_ue_coefs: ue_info["Coef."] = ue.coefficient ue_info["Coef._class"] = "ue_coef" - rows.append(ue_info) + 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) mod_inscrits = sco_moduleimpl.do_moduleimpl_inscription_list( moduleimpl_id=modimpl.id ) enseignants = ", ".join(ens.get_prenomnom() for ens in modimpl.enseignants) - l = { + row = { "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 "", "Module": modimpl.module.abbrev or modimpl.module.titre, "_Module_class": "scotext", @@ -692,13 +699,13 @@ def formsemestre_description_table( sum_coef += modimpl.module.coefficient coef_dict = modimpl.module.get_ue_coef_dict() 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: - l["parcours"] = ", ".join( + row["parcours"] = ", ".join( sorted([pa.code for pa in modimpl.module.parcours]) ) - rows.append(l) + rows.append(row) if with_evals: # Ajoute lignes pour evaluations @@ -715,9 +722,9 @@ def formsemestre_description_table( ) e["_jour_order"] = e["jour"].isoformat() e["jour"] = e["jour"].strftime("%d/%m/%Y") if e["jour"] else "" - e["UE"] = l["UE"] - e["_UE_td_attrs"] = l["_UE_td_attrs"] - e["Code"] = l["Code"] + e["UE"] = row["UE"] + e["_UE_td_attrs"] = row["_UE_td_attrs"] + e["Code"] = row["Code"] e["_css_row_class"] = "evaluation" e["Module"] = "éval." # Cosmetic: conversions pour affichage