From 262d68c844c8ca1aa472e6286374799c4e894598 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 22 Aug 2023 18:00:13 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20calcul=20moyenne=20g=C3=A9n=C3=A9rale=20?= =?UTF-8?q?BUT=20si=20aucune=20UE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/comp/moy_sem.py | 4 ++++ app/scodoc/sco_utils.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/comp/moy_sem.py b/app/comp/moy_sem.py index a1fe0104..15313550 100644 --- a/app/comp/moy_sem.py +++ b/app/comp/moy_sem.py @@ -78,7 +78,11 @@ def compute_sem_moys_apc_using_ects( else: ects = ects_df.to_numpy() # ects est maintenant un array nb_etuds x nb_ues + moy_gen = (etud_moy_ue_df * ects).sum(axis=1) / ects.sum(axis=1) + except ZeroDivisionError: + # peut arriver si aucun module... on ignore + moy_gen = pd.Series(np.NaN, index=etud_moy_ue_df.index) except TypeError: if None in ects: formation = db.session.get(Formation, formation_id) diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index e22e0e87..6bc8e8f5 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -260,7 +260,7 @@ class AssiduitesMetrics: """Labels associés au métrique de l'assiduité""" SHORT: list[str] = ["1/2 J.", "J.", "H."] - LONG: list[str] = ["Demi-Journée", "Journée", "Heure"] + LONG: list[str] = ["Demi-journée", "Journée", "Heure"] TAG: list[str] = ["demi", "journee", "heure"]