Fix affichage moyennes groupes sur moduleimpl_status si tous EXC

This commit is contained in:
Emmanuel Viennet 2024-06-25 18:10:01 +02:00
parent 9be3c9105f
commit ab65ae375f
2 changed files with 18 additions and 8 deletions

View File

@ -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

View File

@ -851,7 +851,7 @@ def _ligne_evaluation(
)
if gr_moyenne["gr_nb_notes"] > 0:
H.append(
f"""{gr_moyenne["gr_moy"]}&nbsp; (<a href="{
f"""{gr_moyenne["gr_moy"]}&nbsp; (<a class="stdlink" href="{
url_for('notes.evaluation_listenotes',
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id,
tf_submitted=1, **{'group_ids:list': gr_moyenne["group_id"]})