diff --git a/app/comp/res_common.py b/app/comp/res_common.py index 0fa9fcd7dd..839f631540 100644 --- a/app/comp/res_common.py +++ b/app/comp/res_common.py @@ -541,7 +541,9 @@ class ResultatsSemestre(ResultatsCache): row["_moy_gen_class"] = "col_moy_gen" # titre de la ligne: row["prenom"] = row["nom_short"] = bottom_line.capitalize() - row["_tr_class"] = bottom_line.lower() + row["_tr_class"] = bottom_line.lower() + ( + (" " + row["_tr_class"]) if "_tr_class" in row else "" + ) footer_rows.append(row) titles_bot.update(titles) footer_rows.append(titles_bot) @@ -554,30 +556,29 @@ class ResultatsSemestre(ResultatsCache): def _recap_bottom_infos(self, ues, modimpl_ids: set, fmt_note) -> dict: """Les informations à mettre en bas de la table: min, max, moy, ECTS""" - bottom_infos = { # { key : row } avec key = min, max, moy, coef - "min": {}, - "max": {}, - "moy": {}, - "coef": {}, - } + row_min, row_max, row_moy, row_coef, row_ects = ( + {"_tr_class": "bottom_info"}, + {"_tr_class": "bottom_info"}, + {"_tr_class": "bottom_info"}, + {"_tr_class": "bottom_info"}, + {"_tr_class": "bottom_info"}, + ) # --- ECTS - row = {} for ue in ues: - row[f"moy_ue_{ue.id}"] = ue.ects - row[f"_moy_ue_{ue.id}_class"] = "col_ue" + row_ects[f"moy_ue_{ue.id}"] = ue.ects + row_ects[f"_moy_ue_{ue.id}_class"] = "col_ue" # style cases vides pour borders verticales - bottom_infos["coef"][f"moy_ue_{ue.id}"] = "" - bottom_infos["coef"][f"_moy_ue_{ue.id}_class"] = "col_ue" - row["moy_gen"] = sum([ue.ects or 0 for ue in ues if ue.type != UE_SPORT]) - row["_moy_gen_class"] = "col_moy_gen" - bottom_infos["ects"] = row + row_coef[f"moy_ue_{ue.id}"] = "" + row_coef[f"_moy_ue_{ue.id}_class"] = "col_ue" + row_ects["moy_gen"] = sum([ue.ects or 0 for ue in ues if ue.type != UE_SPORT]) + row_ects["_moy_gen_class"] = "col_moy_gen" # --- MIN, MAX, MOY - row_min, row_max, row_moy = {}, {}, {} + row_min["moy_gen"] = fmt_note(self.etud_moy_gen.min()) row_max["moy_gen"] = fmt_note(self.etud_moy_gen.max()) row_moy["moy_gen"] = fmt_note(self.etud_moy_gen.mean()) - for ue in [ue for ue in ues if ue.type != UE_SPORT]: + for ue in ues: col_id = f"moy_ue_{ue.id}" row_min[col_id] = fmt_note(self.etud_moy_ue[ue.id].min()) row_max[col_id] = fmt_note(self.etud_moy_ue[ue.id].max()) @@ -593,16 +594,19 @@ class ResultatsSemestre(ResultatsCache): coef = self.modimpl_coefs_df[modimpl.id][ue.id] else: coef = modimpl.module.coefficient or 0 - bottom_infos["coef"][col_id] = fmt_note(coef) + row_coef[col_id] = fmt_note(coef) notes = self.modimpl_notes(modimpl.id, ue.id) row_min[col_id] = fmt_note(np.nanmin(notes)) row_max[col_id] = fmt_note(np.nanmax(notes)) row_moy[col_id] = fmt_note(np.nanmean(notes)) - bottom_infos["min"] = row_min - bottom_infos["max"] = row_max - bottom_infos["moy"] = row_moy - return bottom_infos + return { # { key : row } avec key = min, max, moy, coef + "min": row_min, + "max": row_max, + "moy": row_moy, + "coef": row_coef, + "ects": row_ects, + } def _recap_etud_groups_infos(self, etudid: int, row: dict, titles: dict): """Table recap: ajoute à row les colonnes sur les groupes pour cet etud""" diff --git a/app/scodoc/sco_recapcomplet.py b/app/scodoc/sco_recapcomplet.py index 2d002f9fd0..117ce5673f 100644 --- a/app/scodoc/sco_recapcomplet.py +++ b/app/scodoc/sco_recapcomplet.py @@ -1015,9 +1015,10 @@ def _gen_cell(key: str, row: dict, elt="td"): attrs += f' data-order="{order}"' content = row.get(key, "") target = row.get(f"_{key}_target") - if content or target: # avec lien + target_attrs = row.get(f"_{key}_target_attrs", "") + if target or target_attrs: # avec lien href = f'href="{target}"' if target else "" - content = f'{content}' + content = f"{content}" return f"<{elt} {attrs}>{content}{elt}>" @@ -1039,7 +1040,9 @@ def gen_formsemestre_recapcomplet_html( '