From ab65ae375f66462a27441f8518b79f23452ef71f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 25 Jun 2024 18:10:01 +0200 Subject: [PATCH] Fix affichage moyennes groupes sur moduleimpl_status si tous EXC --- app/scodoc/sco_evaluations.py | 24 +++++++++++++++++------- app/scodoc/sco_moduleimpl_status.py | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index bcf027723..e932ef98a 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -64,18 +64,28 @@ import sco_version # -------------------------------------------------------------------- def notes_moyenne_median_mini_maxi(notes): "calcule moyenne et mediane d'une liste de valeurs (floats)" - notes = [ + notes_num = [ x for x in notes - if (x != None) and (x != scu.NOTES_NEUTRALISE) and (x != scu.NOTES_ATTENTE) + if (x is not None) and (x != scu.NOTES_NEUTRALISE) and (x != scu.NOTES_ATTENTE) ] - n = len(notes) + n = len(notes_num) if not n: + # Aucune note numérique + # si elles sont toutes EXC, renvoie EXC + if all(x == scu.NOTES_NEUTRALISE for x in notes): + return ( + scu.NOTES_NEUTRALISE, + scu.NOTES_NEUTRALISE, + scu.NOTES_NEUTRALISE, + scu.NOTES_NEUTRALISE, + ) + # sinon renvoie ABS return None, None, None, None - moy = sum(notes) / n - median = list_median(notes) - mini = min(notes) - maxi = max(notes) + moy = sum(notes_num) / n + median = list_median(notes_num) + mini = min(notes_num) + maxi = max(notes_num) return moy, median, mini, maxi diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 5897ea466..019000cbd 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -851,7 +851,7 @@ def _ligne_evaluation( ) if gr_moyenne["gr_nb_notes"] > 0: H.append( - f"""{gr_moyenne["gr_moy"]}  (