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,13 +214,22 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
Evaluation.date_debut.desc(),
).all()
nb_evaluations = len(evaluations)
max_poids = max(
[
max([p.poids for p in e.ue_poids] or [0]) * (e.coefficient or 0.0)
for e in evaluations
]
or [0]
)
# 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)
for e in evaluations
if e.evaluation_type == eval_type
]
or [0.0]
)
#
sem_locked = not formsemestre.etat
can_edit_evals = (
@ -481,7 +490,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
eval_index=eval_index,
nb_evals=nb_evaluations,
is_apc=nt.is_apc,
max_poids=max_poids,
max_poids=max_poids_by_type.get(evaluation.evaluation_type, 10000.0),
)
)
eval_index -= 1