From 48d0d89ede3e7ccb85777d22b35402afdce49bce Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 15 Mar 2022 22:24:52 +0100 Subject: [PATCH] Fixes #335 --- app/but/bulletin_but.py | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index 3012a7a95..e4822703a 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -9,6 +9,7 @@ import collections import datetime +import numpy as np from flask import url_for, g from app.comp.res_but import ResultatsSemestreBUT @@ -295,20 +296,24 @@ class BulletinBUT: sco_bulletins_json.dict_decision_jury(etud.id, formsemestre.id) ) if etat_inscription == scu.INSCRIT: - semestre_infos.update( - { - "notes": { # moyenne des moyennes générales du semestre - "value": fmt_note(res.etud_moy_gen[etud.id]), - "min": fmt_note(res.etud_moy_gen.min()), - "moy": fmt_note(res.etud_moy_gen.mean()), - "max": fmt_note(res.etud_moy_gen.max()), - }, - "rang": { # classement wrt moyenne général, indicatif - "value": res.etud_moy_gen_ranks[etud.id], - "total": nb_inscrits, - }, - }, - ) + # moyenne des moyennes générales du semestre + semestre_infos["notes"] = { + "value": fmt_note(res.etud_moy_gen[etud.id]), + "min": fmt_note(res.etud_moy_gen.min()), + "moy": fmt_note(res.etud_moy_gen.mean()), + "max": fmt_note(res.etud_moy_gen.max()), + } + if self.prefs["bul_show_rangs"] and not np.isnan(res.etud_moy_gen[etud.id]): + # classement wrt moyenne général, indicatif + semestre_infos["rang"] = { + "value": res.etud_moy_gen_ranks[etud.id], + "total": nb_inscrits, + } + else: + semestre_infos["rang"] = { + "value": "-", + "total": nb_inscrits, + } d.update( { "ressources": self.etud_mods_results(