forked from ScoDoc/ScoDoc
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(),
|
Evaluation.heure_debut.desc(),
|
||||||
).all()
|
).all()
|
||||||
nb_evaluations = len(evaluations)
|
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"]
|
sem_locked = not sem["etat"]
|
||||||
can_edit_evals = (
|
can_edit_evals = (
|
||||||
@ -454,6 +460,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,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
eval_index -= 1
|
eval_index -= 1
|
||||||
@ -506,7 +513,7 @@ def _ligne_evaluation(
|
|||||||
modimpl: ModuleImpl,
|
modimpl: ModuleImpl,
|
||||||
evaluation: Evaluation,
|
evaluation: Evaluation,
|
||||||
first_eval: bool = True,
|
first_eval: bool = True,
|
||||||
partition_id=None,
|
partition_id: int = None,
|
||||||
arrow_down=None,
|
arrow_down=None,
|
||||||
arrow_none=None,
|
arrow_none=None,
|
||||||
arrow_up=None,
|
arrow_up=None,
|
||||||
@ -514,7 +521,8 @@ def _ligne_evaluation(
|
|||||||
can_edit_notes: bool = False,
|
can_edit_notes: bool = False,
|
||||||
eval_index: int = 0,
|
eval_index: int = 0,
|
||||||
nb_evals: int = 0,
|
nb_evals: int = 0,
|
||||||
is_apc=False,
|
is_apc: bool = False,
|
||||||
|
max_poids: float = 0.0,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Ligne <tr> décrivant une évaluation dans le tableau de bord moduleimpl."""
|
"""Ligne <tr> décrivant une évaluation dans le tableau de bord moduleimpl."""
|
||||||
H = []
|
H = []
|
||||||
@ -549,8 +557,8 @@ def _ligne_evaluation(
|
|||||||
if coef < scu.NOTES_PRECISION:
|
if coef < scu.NOTES_PRECISION:
|
||||||
H.append("""<span class="eval_warning_coef">coef. nul !</span>""")
|
H.append("""<span class="eval_warning_coef">coef. nul !</span>""")
|
||||||
elif is_apc:
|
elif is_apc:
|
||||||
# visualisation des poids
|
# visualisation des poids (Hinton map)
|
||||||
H.append(_evaluation_poids_html(evaluation))
|
H.append(_evaluation_poids_html(evaluation, max_poids))
|
||||||
H.append("""<div class="evaluation_titre">""")
|
H.append("""<div class="evaluation_titre">""")
|
||||||
if evaluation.jour:
|
if evaluation.jour:
|
||||||
H.append(
|
H.append(
|
||||||
@ -751,17 +759,17 @@ def _ligne_evaluation(
|
|||||||
H.append(f"""<tr class="{tr_class}"><td> </td>""")
|
H.append(f"""<tr class="{tr_class}"><td> </td>""")
|
||||||
if first_group and modimpl.module.is_apc():
|
if first_group and modimpl.module.is_apc():
|
||||||
H.append(
|
H.append(
|
||||||
f"""<td class="eval_poids" colspan="3">{
|
f"""<td class="eval_poids" colspan="4">{
|
||||||
evaluation.get_ue_poids_str()}</td>"""
|
evaluation.get_ue_poids_str()}</td>"""
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
H.append("""<td colspan="3"></td>""")
|
H.append("""<td colspan="4"></td>""")
|
||||||
first_group = False
|
first_group = False
|
||||||
if gr_moyenne["group_name"] is None:
|
if gr_moyenne["group_name"] is None:
|
||||||
name = "Tous" # tous
|
name = "Tous" # tous
|
||||||
else:
|
else:
|
||||||
name = f"""Groupe {gr_moyenne["group_name"]}"""
|
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:
|
if gr_moyenne["gr_nb_notes"] > 0:
|
||||||
H.append(
|
H.append(
|
||||||
f"""{gr_moyenne["gr_moy"]} (<a href="{
|
f"""{gr_moyenne["gr_moy"]} (<a href="{
|
||||||
@ -804,12 +812,11 @@ def _ligne_evaluation(
|
|||||||
return "\n".join(H)
|
return "\n".join(H)
|
||||||
|
|
||||||
|
|
||||||
def _evaluation_poids_html(evaluation: Evaluation) -> str:
|
def _evaluation_poids_html(evaluation: Evaluation, max_poids: float = 0.0) -> str:
|
||||||
"""graphe html montrant les poids de l'évaluation"""
|
"""graphe html (Hinton map) montrant les poids x coef de l'évaluation"""
|
||||||
ue_poids = evaluation.get_ue_poids_dict(sort=True) # { ue_id : poids }
|
ue_poids = evaluation.get_ue_poids_dict(sort=True) # { ue_id : poids }
|
||||||
if not ue_poids:
|
if not ue_poids:
|
||||||
return
|
return
|
||||||
max_poids = max(ue_poids.values())
|
|
||||||
if max_poids < scu.NOTES_PRECISION:
|
if max_poids < scu.NOTES_PRECISION:
|
||||||
return
|
return
|
||||||
H = (
|
H = (
|
||||||
@ -817,7 +824,7 @@ def _evaluation_poids_html(evaluation: Evaluation) -> str:
|
|||||||
+ "\n".join(
|
+ "\n".join(
|
||||||
[
|
[
|
||||||
f"""<div title="poids vers {ue.acronyme}: {poids:g}">
|
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 ''}
|
{'background-color: ' + ue.color + ';' if ue.color else ''}
|
||||||
"></div>
|
"></div>
|
||||||
</div>"""
|
</div>"""
|
||||||
|
@ -1943,7 +1943,7 @@ span.evalindex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
table.moduleimpl_evaluations td.eval_poids {
|
table.moduleimpl_evaluations td.eval_poids {
|
||||||
color: rgb(0, 0, 255);
|
color: rgb(234, 110, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
span.eval_coef_ue {
|
span.eval_coef_ue {
|
||||||
|
Loading…
Reference in New Issue
Block a user