From ddea186a486a1452d795f2f50c42d826e4b551d4 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 12 Feb 2023 14:09:37 +0100 Subject: [PATCH] Table recap: bouton cols 'Vides' seulement si il y en a. --- app/comp/res_but.py | 2 ++ app/static/js/table_recap.js | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/comp/res_but.py b/app/comp/res_but.py index 9e3af6f7..502cd980 100644 --- a/app/comp/res_but.py +++ b/app/comp/res_but.py @@ -159,6 +159,8 @@ class ResultatsSemestreBUT(NotesTableCompat): # moyenne sur les UE: if len(self.sem_cube[etud_idx, mod_idx]): return np.nanmean(self.sem_cube[etud_idx, mod_idx]) + # note: si toutes les valeurs sont nan, on va déclencher ici + # un RuntimeWarning: Mean of empty slice return np.nan def compute_etud_ue_coef(self, etudid: int, ue: UniteEns) -> float: diff --git a/app/static/js/table_recap.js b/app/static/js/table_recap.js index aa322de2..d2d8840e 100644 --- a/app/static/js/table_recap.js +++ b/app/static/js/table_recap.js @@ -146,10 +146,13 @@ $(function () { action: toggle_col_but_visibility, }); } - buttons.push({ // modules vides - text: 'Vides', - action: toggle_col_but_visibility, - }); + // S'il y a des colonnes vides: + if ($('table.table_recap td.col_empty').length > 0) { + buttons.push({ // modules vides + text: 'Vides', + action: toggle_col_but_visibility, + }); + } // Boutons admission (pas en jury) if (!$('table.table_recap').hasClass("jury")) { buttons.push(