Cosmetic: tableau bord module: normalise poids évaluations pour Hinton Map
This commit is contained in:
parent
63fb09348d
commit
7b3c50620b
@ -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 <tr> 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("""<span class="eval_warning_coef">coef. nul !</span>""")
|
||||
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("""<div class="evaluation_titre">""")
|
||||
if evaluation.jour:
|
||||
H.append(
|
||||
@ -751,17 +759,17 @@ def _ligne_evaluation(
|
||||
H.append(f"""<tr class="{tr_class}"><td> </td>""")
|
||||
if first_group and modimpl.module.is_apc():
|
||||
H.append(
|
||||
f"""<td class="eval_poids" colspan="3">{
|
||||
f"""<td class="eval_poids" colspan="4">{
|
||||
evaluation.get_ue_poids_str()}</td>"""
|
||||
)
|
||||
else:
|
||||
H.append("""<td colspan="3"></td>""")
|
||||
H.append("""<td colspan="4"></td>""")
|
||||
first_group = False
|
||||
if gr_moyenne["group_name"] is None:
|
||||
name = "Tous" # tous
|
||||
else:
|
||||
name = f"""Groupe {gr_moyenne["group_name"]}"""
|
||||
H.append(f"""<td colspan="3" class="mievr_grtit">{name} </td><td>""")
|
||||
H.append(f"""<td colspan="2" class="mievr_grtit">{name} </td><td>""")
|
||||
if gr_moyenne["gr_nb_notes"] > 0:
|
||||
H.append(
|
||||
f"""{gr_moyenne["gr_moy"]} (<a href="{
|
||||
@ -804,12 +812,11 @@ def _ligne_evaluation(
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
def _evaluation_poids_html(evaluation: Evaluation) -> 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"""<div title="poids vers {ue.acronyme}: {poids:g}">
|
||||
<div style="--size:{math.sqrt(poids/max_poids*144)}px;
|
||||
<div style="--size:{math.sqrt(poids*(evaluation.coefficient or 0.)/max_poids*144)}px;
|
||||
{'background-color: ' + ue.color + ';' if ue.color else ''}
|
||||
"></div>
|
||||
</div>"""
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user