Ajout ligne avec type sur table recap. Voir #561. Mais pas exporté en Excel.

This commit is contained in:
Emmanuel Viennet 2023-01-14 17:56:41 -03:00 committed by iziram
parent 6833a28274
commit b5cf210112
3 changed files with 22 additions and 2 deletions

View File

@ -760,6 +760,20 @@ class ResultatsSemestre(ResultatsCache):
for row in bottom_infos.values(): for row in bottom_infos.values():
row[c_class] = row.get(c_class, "") + " col_empty" row[c_class] = row.get(c_class, "") + " col_empty"
# Ligne avec la classe de chaque colonne
# récupère le type à partir des classes css (hack...)
row_class = {}
for col_id in titles:
klass = titles.get(f"_{col_id}_class")
if klass:
row_class[col_id] = " ".join(
cls[4:] for cls in klass.split() if cls.startswith("col_")
)
# cette case (nb d'UE validables) a deux classes col_xxx, on en garde une seule:
if "ues_validables" in row_class[col_id]:
row_class[col_id] = "ues_validables"
bottom_infos["type_col"] = row_class
# --- TABLE FOOTER: ECTS, moyennes, min, max... # --- TABLE FOOTER: ECTS, moyennes, min, max...
footer_rows = [] footer_rows = []
for (bottom_line, row) in bottom_infos.items(): for (bottom_line, row) in bottom_infos.items():
@ -783,7 +797,7 @@ class ResultatsSemestre(ResultatsCache):
return (rows, footer_rows, titles, column_ids) return (rows, footer_rows, titles, column_ids)
def _recap_bottom_infos(self, ues, modimpl_ids: set, fmt_note) -> dict: def _recap_bottom_infos(self, ues, modimpl_ids: set, fmt_note) -> dict:
"""Les informations à mettre en bas de la table: min, max, moy, ECTS""" """Les informations à mettre en bas de la table: min, max, moy, ECTS, Apo"""
row_min, row_max, row_moy, row_coef, row_ects, row_apo = ( row_min, row_max, row_moy, row_coef, row_ects, row_apo = (
{"_tr_class": "bottom_info", "_title": "Min."}, {"_tr_class": "bottom_info", "_title": "Min."},
{"_tr_class": "bottom_info"}, {"_tr_class": "bottom_info"},
@ -843,7 +857,7 @@ class ResultatsSemestre(ResultatsCache):
row_moy[f"_{colid}_class"] = "col_empty" row_moy[f"_{colid}_class"] = "col_empty"
row_apo[colid] = modimpl.module.code_apogee or "" row_apo[colid] = modimpl.module.code_apogee or ""
return { # { key : row } avec key = min, max, moy, coef return { # { key : row } avec key = min, max, moy, coef, ...
"min": row_min, "min": row_min,
"max": row_max, "max": row_max,
"moy": row_moy, "moy": row_moy,

View File

@ -4199,6 +4199,11 @@ table.table_recap tr.apo td {
background-color: #d8f5fe; background-color: #d8f5fe;
} }
table.table_recap tr.type_col {
font-size: 50%;
font-family: monospace;
}
table.table_recap td.evaluation.first, table.table_recap td.evaluation.first,
table.table_recap th.evaluation.first { table.table_recap th.evaluation.first {
border-left: 2px solid rgb(4, 16, 159); border-left: 2px solid rgb(4, 16, 159);

View File

@ -201,6 +201,7 @@ $(function () {
}, },
{ {
extend: 'excelHtml5', extend: 'excelHtml5',
// footer: true, // ne fonctionne pas ?
exportOptions: { orthogonal: 'export' }, exportOptions: { orthogonal: 'export' },
title: document.querySelector('table.table_recap').dataset.filename title: document.querySelector('table.table_recap').dataset.filename
}, },