diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index e3175ff80..e3f5cf01b 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -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