Ameliore affichage et export des malus dans table recap.

This commit is contained in:
Emmanuel Viennet 2023-02-02 15:22:29 -03:00
parent 79c4a23ab9
commit 778f80f14b
3 changed files with 31 additions and 9 deletions

View File

@ -749,13 +749,22 @@ class ResultatsSemestre(ResultatsCache):
val = "" val = ""
col_id = f"moy_{modimpl.module.type_abbrv()}_{modimpl.id}_{ue.id}" col_id = f"moy_{modimpl.module.type_abbrv()}_{modimpl.id}_{ue.id}"
val_fmt = val_fmt_html = table.fmt_note(val)
val_fmt_html = val_fmt = table.fmt_note(val)
if modimpl.module.module_type == scu.ModuleType.MALUS: if modimpl.module.module_type == scu.ModuleType.MALUS:
val_fmt_html = ( if val and not isinstance(val, str) and not np.isnan(val):
(scu.EMO_RED_TRIANGLE_DOWN + val_fmt) if val >= 0:
if val and not np.isnan(val) val_fmt_html = f"""<span class="red-arrow-down"></span><span class="sp2l">+{
else "" val_fmt
) }</span>"""
else:
# val_fmt_html = (scu.EMO_RED_TRIANGLE_DOWN + val_fmt)
val_fmt_html = f"""<span class="green-arrow-up"></span><span class="sp2l malus_negatif">-{
table.fmt_note(-val)
}</span>"""
else:
val_fmt = val_fmt_html = "" # inscrit à ce malus, mais sans note
cell = row.add_cell( cell = row.add_cell(
col_id, col_id,
modimpl.module.code, modimpl.module.code,

View File

@ -4143,6 +4143,15 @@ table.table_recap td.col_ues_validables {
border-bottom: 8px solid rgb(48, 239, 0); border-bottom: 8px solid rgb(48, 239, 0);
} }
.red-arrow-down {
display: inline-block;
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid red;
}
table.table_recap td.col_ue_bonus, table.table_recap td.col_ue_bonus,
table.table_recap th.col_ue_bonus { table.table_recap th.col_ue_bonus {
font-size: 80%; font-size: 80%;
@ -4150,10 +4159,14 @@ table.table_recap th.col_ue_bonus {
color: rgb(0, 128, 11); color: rgb(0, 128, 11);
} }
table.table_recap td.col_ue_bonus>span.sp2l { table.table_recap span.sp2l {
margin-left: 2px; margin-left: 2px;
} }
table.table_recap .malus_negatif {
color: green;
}
table.table_recap td.col_ue_bonus { table.table_recap td.col_ue_bonus {
white-space: nowrap; white-space: nowrap;
} }

View File

@ -201,10 +201,10 @@ $(function () {
} }
}, },
{ {
// Elimine les décorations (fleches bonus/malus) pour les exports // Elimine les "+"" pour les exports
targets: ["col_ue_bonus", "col_malus"], targets: ["col_ue_bonus", "col_malus"],
render: function (data, type, row) { render: function (data, type, row) {
return type === 'export' ? data.replace(/.*(\d\d\.\d\d)/, '$1').replace(/0(\d\..*)/, '$1') : data; return type === 'export' ? data.replace(/.*\+(\d?\d?\.\d\d).*/m, '$1').replace(/0(\d\..*)/, '$1') : data;
} }
}, },
{ {