1
0
forked from ScoDoc/ScoDoc

Affichage poids sur tableau de bord module: normalisation par evaluation_type. Closes #886

This commit is contained in:
Emmanuel Viennet 2024-05-29 12:12:31 +02:00
parent e44d3fd5dc
commit e7f23efe65

View File

@ -214,12 +214,21 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
Evaluation.date_debut.desc(), Evaluation.date_debut.desc(),
).all() ).all()
nb_evaluations = len(evaluations) nb_evaluations = len(evaluations)
max_poids = max( # Le poids max pour chaque catégorie d'évaluation
max_poids_by_type: dict[int, float] = {}
for eval_type in (
Evaluation.EVALUATION_NORMALE,
Evaluation.EVALUATION_RATTRAPAGE,
Evaluation.EVALUATION_SESSION2,
Evaluation.EVALUATION_BONUS,
):
max_poids_by_type[eval_type] = max(
[ [
max([p.poids for p in e.ue_poids] or [0]) * (e.coefficient or 0.0) max([p.poids for p in e.ue_poids] or [0]) * (e.coefficient or 0.0)
for e in evaluations for e in evaluations
if e.evaluation_type == eval_type
] ]
or [0] or [0.0]
) )
# #
sem_locked = not formsemestre.etat sem_locked = not formsemestre.etat
@ -481,7 +490,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
eval_index=eval_index, eval_index=eval_index,
nb_evals=nb_evaluations, nb_evals=nb_evaluations,
is_apc=nt.is_apc, is_apc=nt.is_apc,
max_poids=max_poids, max_poids=max_poids_by_type.get(evaluation.evaluation_type, 10000.0),
) )
) )
eval_index -= 1 eval_index -= 1