From ef2d00b0b8c8fc7051eb0259602539b99fe48cc1 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 15 Dec 2022 21:27:52 -0300 Subject: [PATCH] =?UTF-8?q?Cosmetic:=20tableau=20bord=20module:=20normalis?= =?UTF-8?q?e=20poids=20=C3=A9valuations=20pour=20Hinton=20Map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_moduleimpl_status.py | 29 ++++++++++++++++++----------- app/static/css/scodoc.css | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 305f03b1..8ecd2ace 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -219,6 +219,12 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None): Evaluation.heure_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 + ] + ) # sem_locked = not sem["etat"] can_edit_evals = ( @@ -454,6 +460,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, ) ) eval_index -= 1 @@ -506,7 +513,7 @@ def _ligne_evaluation( modimpl: ModuleImpl, evaluation: Evaluation, first_eval: bool = True, - partition_id=None, + partition_id: int = None, arrow_down=None, arrow_none=None, arrow_up=None, @@ -514,7 +521,8 @@ def _ligne_evaluation( can_edit_notes: bool = False, eval_index: int = 0, nb_evals: int = 0, - is_apc=False, + is_apc: bool = False, + max_poids: float = 0.0, ) -> str: """Ligne décrivant une évaluation dans le tableau de bord moduleimpl.""" H = [] @@ -549,8 +557,8 @@ def _ligne_evaluation( if coef < scu.NOTES_PRECISION: H.append("""coef. nul !""") elif is_apc: - # visualisation des poids - H.append(_evaluation_poids_html(evaluation)) + # visualisation des poids (Hinton map) + H.append(_evaluation_poids_html(evaluation, max_poids)) H.append("""
""") if evaluation.jour: H.append( @@ -751,17 +759,17 @@ def _ligne_evaluation( H.append(f""" """) if first_group and modimpl.module.is_apc(): H.append( - f"""{ + f"""{ evaluation.get_ue_poids_str()}""" ) else: - H.append("""""") + H.append("""""") first_group = False if gr_moyenne["group_name"] is None: name = "Tous" # tous else: name = f"""Groupe {gr_moyenne["group_name"]}""" - H.append(f"""{name}  """) + H.append(f"""{name}  """) if gr_moyenne["gr_nb_notes"] > 0: H.append( f"""{gr_moyenne["gr_moy"]}  ( str: - """graphe html montrant les poids de l'évaluation""" +def _evaluation_poids_html(evaluation: Evaluation, max_poids: float = 0.0) -> str: + """graphe html (Hinton map) montrant les poids x coef de l'évaluation""" ue_poids = evaluation.get_ue_poids_dict(sort=True) # { ue_id : poids } if not ue_poids: return - max_poids = max(ue_poids.values()) if max_poids < scu.NOTES_PRECISION: return H = ( @@ -817,7 +824,7 @@ def _evaluation_poids_html(evaluation: Evaluation) -> str: + "\n".join( [ f"""
-
""" diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 102760f0..5bad1423 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -1943,7 +1943,7 @@ span.evalindex { } table.moduleimpl_evaluations td.eval_poids { - color: rgb(0, 0, 255); + color: rgb(234, 110, 20); } span.eval_coef_ue {