From b140e891f13e77a3e2521786a3ee6656fbbacc98 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 8 Jun 2022 22:18:39 +0200 Subject: [PATCH] Bonus La Rochelle (nouvelle version) --- app/comp/bonus_spo.py | 47 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/app/comp/bonus_spo.py b/app/comp/bonus_spo.py index cd2db6316..6cf0767f0 100644 --- a/app/comp/bonus_spo.py +++ b/app/comp/bonus_spo.py @@ -771,18 +771,59 @@ class BonusLaRochelle(BonusSportAdditif): """Calcul bonus modules optionnels (sport, culture), règle IUT de La Rochelle. """ name = "bonus_iutlr" displayed_name = "IUT de La Rochelle" + seuil_moy_gen = 10.0 # si bonus > 10, seuil_comptage = 0.0 # tous les points sont comptés proportion_point = 0.01 # 1% + def compute_bonus(self, sem_modimpl_moys_inscrits, modimpl_coefs_etuds_no_nan): + """calcul du bonus""" + # La date du semestre ? + if self.formsemestre.formation.is_apc(): + if 0 in sem_modimpl_moys_inscrits.shape: + # pas d'étudiants ou pas d'UE ou pas de module... + return + # Calcule moyenne pondérée des notes de sport: + with np.errstate(invalid="ignore"): # ignore les 0/0 (-> NaN) + bonus_moy_arr = np.sum( + sem_modimpl_moys_inscrits * modimpl_coefs_etuds_no_nan, axis=1 + ) / np.sum(modimpl_coefs_etuds_no_nan, axis=1) + np.nan_to_num(bonus_moy_arr, nan=0.0, copy=False) + bonus_moy_arr[bonus_moy_arr < 10.0] = 0.0 + bonus_moy_arr[bonus_moy_arr >= 18.0] = 0.10 + bonus_moy_arr[bonus_moy_arr >= 16.0] = 0.08 + bonus_moy_arr[bonus_moy_arr >= 14.0] = 0.06 + bonus_moy_arr[bonus_moy_arr >= 12.0] = 0.04 + bonus_moy_arr[bonus_moy_arr >= 10.0] = 0.02 + self.bonus_additif(bonus_moy_arr) + else: + # DUT et LP: + return super().compute_bonus( + sem_modimpl_moys_inscrits, modimpl_coefs_etuds_no_nan + ) + class BonusLeHavre(BonusSportAdditif): """Bonus sport IUT du Havre sur les moyennes d'UE