diff --git a/app/models/modules.py b/app/models/modules.py
index 5abb5340..f05e66a8 100644
--- a/app/models/modules.py
+++ b/app/models/modules.py
@@ -340,6 +340,21 @@ class Module(models.ScoDocModel):
# Liste seulement les coefs définis:
return [(c.ue, c.coef) for c in self.get_ue_coefs_sorted()]
+ def get_ue_coefs_descr(self) -> str:
+ """Description des coefficients vers les UEs (APC)"""
+ coefs_descr = ", ".join(
+ [
+ f"{ue.acronyme}: {co}"
+ for ue, co in self.ue_coefs_list()
+ if isinstance(co, float) and co > 0
+ ]
+ )
+ if coefs_descr:
+ descr = "Coefs: " + coefs_descr
+ else:
+ descr = "(pas de coefficients) "
+ return descr
+
def get_codes_apogee(self) -> set[str]:
"""Les codes Apogée (codés en base comme "VRT1,VRT2")"""
if self.code_apogee:
diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py
index 0d7686ec..3ac60eeb 100755
--- a/app/scodoc/sco_formsemestre_status.py
+++ b/app/scodoc/sco_formsemestre_status.py
@@ -822,7 +822,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
-
+
"""
)
if can_edit_abs:
@@ -875,7 +875,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
group_ids=group.id,
)}" title="Page en cours de fusion et sera prochainement supprimée. Veuillez utiliser la page `Saisir l'assiduité`">
(Saisie différée)
-
+
"""
)
@@ -1188,17 +1188,7 @@ def formsemestre_tableau_modules(
mod_descr = "Module " + (mod.titre or "")
is_apc = mod.is_apc() # SAE ou ressource
if is_apc:
- coef_descr = ", ".join(
- [
- f"{ue.acronyme}: {co}"
- for ue, co in mod.ue_coefs_list()
- if isinstance(co, float) and co > 0
- ]
- )
- if coef_descr:
- mod_descr += " Coefs: " + coef_descr
- else:
- mod_descr += " (pas de coefficients) "
+ mod_descr += " " + mod.get_ue_coefs_descr()
else:
mod_descr += ", coef. " + str(mod.coefficient)
mod_ens = sco_users.user_info(modimpl.responsable_id)["nomcomplet"]
diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py
index 328bb606..e3175ff8 100644
--- a/app/scodoc/sco_moduleimpl_status.py
+++ b/app/scodoc/sco_moduleimpl_status.py
@@ -146,29 +146,48 @@ def moduleimpl_evaluation_menu(evaluation: Evaluation, nbnotes: int = 0) -> str:
return htmlutils.make_menu("actions", menu_eval, alone=True)
-def _ue_coefs_html(coefs_lst) -> str:
+def _ue_coefs_html(modimpl: ModuleImpl) -> str:
""" """
- max_coef = max([x[1] for x in coefs_lst]) if coefs_lst else 1.0
- H = """
+ coefs_lst = modimpl.module.ue_coefs_list()
+ max_coef = max(x[1] for x in coefs_lst) if coefs_lst else 1.0
+ H = f"""
-
Coefficients vers les UE
- """
- if coefs_lst:
- H += (
- f"""
-
- """
- + "\n".join(
- [
- f"""
"""
- for ue, coef in coefs_lst
- if coef > 0
- ]
+
+ """
+
+ if coefs_lst:
+ H += _html_hinton_map(
+ colors=(uc[0].color for uc in coefs_lst),
+ max_val=max_coef,
+ size=36,
+ title=modimpl.module.get_ue_coefs_descr(),
+ values=(uc[1] for uc in coefs_lst),
)
+ # (
+ # f"""
+ #
+ # """
+ # + "\n".join(
+ # [
+ # f"""
"""
+ # for ue, coef in coefs_lst
+ # if coef > 0
+ # ]
+ # )
+ # + "
"
+ # )
else:
H += """
non définis
"""
H += "
"
@@ -265,7 +284,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
H.append(scu.icontag("lock32_img", title="verrouillé"))
H.append("""
""")
if modimpl.module.is_apc():
- H.append(_ue_coefs_html(modimpl.module.ue_coefs_list()))
+ H.append(_ue_coefs_html(modimpl))
else:
H.append(
f"""Coef. dans le semestre: {
@@ -781,27 +800,27 @@ def _ligne_evaluation(
#
if etat["nb_notes"] == 0:
H.append(f""" | | """)
- if modimpl.module.is_apc():
- H.append(
- f"""{
- evaluation.get_ue_poids_str()} | """
- )
- else:
- H.append(' | ')
+ # if modimpl.module.is_apc():
+ # H.append(
+ # f"""{
+ # evaluation.get_ue_poids_str()} | """
+ # )
+ # else:
+ # H.append(' | ')
H.append("""
""")
else: # il y a deja des notes saisies
gr_moyennes = etat["gr_moyennes"]
- first_group = True
+ # first_group = True
for gr_moyenne in gr_moyennes:
H.append(f"""
| """)
- if first_group and modimpl.module.is_apc():
- H.append(
- f"""{
- evaluation.get_ue_poids_str()} | """
- )
- else:
- H.append(""" | """)
- first_group = False
+ # if first_group and modimpl.module.is_apc():
+ # H.append(
+ # f"""{
+ # evaluation.get_ue_poids_str()} | """
+ # )
+ # else:
+ H.append(""" | """)
+ # first_group = False
if gr_moyenne["group_name"] is None:
name = "Tous" # tous
else:
@@ -857,26 +876,47 @@ def _evaluation_poids_html(evaluation: Evaluation, max_poids: float = 0.0) -> st
ue_poids = evaluation.get_ue_poids_dict(sort=True) # { ue_id : poids }
if not ue_poids:
return ""
- if max_poids < scu.NOTES_PRECISION:
+ values = [poids * (evaluation.coefficient) for poids in ue_poids.values()]
+ colors = [db.session.get(UniteEns, ue_id).color for ue_id in ue_poids]
+ return _html_hinton_map(
+ classes=("evaluation_poids",),
+ colors=colors,
+ max_val=max_poids,
+ title=f"Poids de l'évaluation vers les UEs: {evaluation.get_ue_poids_str()}",
+ values=values,
+ )
+
+
+def _html_hinton_map(
+ classes=(),
+ colors=(),
+ max_val: float | None = None,
+ size=12,
+ title: str = "",
+ values=(),
+) -> str:
+ """Représente une liste de nombres sous forme de carrés"""
+ if max_val is None:
+ max_val = max(values)
+ if max_val < scu.NOTES_PRECISION:
return ""
- H = (
- """"""
+ return (
+ f"""
"""
+ "\n".join(
[
- f"""
-
"""
- for ue, poids in (
- (db.session.get(UniteEns, ue_id), poids)
- for ue_id, poids in ue_poids.items()
- )
+ for value, color in zip(values, colors)
]
)
+ "
"
)
- return H
def _html_modimpl_etuds_attente(res: ResultatsSemestre, modimpl: ModuleImpl) -> str:
diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css
index d0977f11..0f152235 100644
--- a/app/static/css/scodoc.css
+++ b/app/static/css/scodoc.css
@@ -2096,8 +2096,9 @@ div.evaluation_titre {
vertical-align: super;
}
+
/* visualisation poids évaluations */
-.evaluation_poids {
+.hinton_map {
height: 12px;
display: inline-flex;
text-align: center;
@@ -2105,10 +2106,10 @@ div.evaluation_titre {
margin-left: 4px;
}
-.evaluation_poids>div {
+.hinton_map>div {
display: inline-flex;
- height: 12px;
- width: 12px;
+ height: var(--size);
+ width: var(--size);
margin-left: 2px;
margin-right: 2px;
border: 1px solid rgb(180, 180, 180);
@@ -2116,9 +2117,9 @@ div.evaluation_titre {
justify-content: center;
}
-.evaluation_poids>div>div {
- height: var(--size);
- width: var(--size);
+.hinton_map>div>div {
+ height: var(--boxsize);
+ width: var(--boxsize);
background: #09c;
}