From 778f80f14bf146070439806c0c16785363f4232c Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 2 Feb 2023 15:22:29 -0300 Subject: [PATCH] Ameliore affichage et export des malus dans table recap. --- app/comp/res_common.py | 21 +++++++++++++++------ app/static/css/scodoc.css | 15 ++++++++++++++- app/static/js/table_recap.js | 4 ++-- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/app/comp/res_common.py b/app/comp/res_common.py index bbb14ca34..fbd12ae58 100644 --- a/app/comp/res_common.py +++ b/app/comp/res_common.py @@ -749,13 +749,22 @@ class ResultatsSemestre(ResultatsCache): val = "" 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: - val_fmt_html = ( - (scu.EMO_RED_TRIANGLE_DOWN + val_fmt) - if val and not np.isnan(val) - else "" - ) + if val and not isinstance(val, str) and not np.isnan(val): + if val >= 0: + val_fmt_html = f"""+{ + val_fmt + }""" + else: + # val_fmt_html = (scu.EMO_RED_TRIANGLE_DOWN + val_fmt) + val_fmt_html = f"""-{ + table.fmt_note(-val) + }""" + else: + val_fmt = val_fmt_html = "" # inscrit à ce malus, mais sans note + cell = row.add_cell( col_id, modimpl.module.code, diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index cb5e0344e..808031f40 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -4143,6 +4143,15 @@ table.table_recap td.col_ues_validables { 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 th.col_ue_bonus { font-size: 80%; @@ -4150,10 +4159,14 @@ table.table_recap th.col_ue_bonus { color: rgb(0, 128, 11); } -table.table_recap td.col_ue_bonus>span.sp2l { +table.table_recap span.sp2l { margin-left: 2px; } +table.table_recap .malus_negatif { + color: green; +} + table.table_recap td.col_ue_bonus { white-space: nowrap; } diff --git a/app/static/js/table_recap.js b/app/static/js/table_recap.js index 62080b4b3..4b45961df 100644 --- a/app/static/js/table_recap.js +++ b/app/static/js/table_recap.js @@ -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"], 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; } }, {