formsemestre_status: affiche modules avec évals bloquées
This commit is contained in:
parent
49a5ec488d
commit
0cf3b0a782
@ -205,6 +205,7 @@ class ResultatsSemestre(ResultatsCache):
|
||||
"coefficient" : float, # 0 si None
|
||||
"description" : str, # de l'évaluation, "" si None
|
||||
"etat" {
|
||||
"blocked" : bool, # vrai si prise en compte bloquée
|
||||
"evalcomplete" : bool,
|
||||
"last_modif" : datetime.datetime | None, # saisie de note la plus récente
|
||||
"nb_notes" : int, # nb notes d'étudiants inscrits
|
||||
@ -232,13 +233,14 @@ class ResultatsSemestre(ResultatsCache):
|
||||
return {
|
||||
"coefficient": evaluation.coefficient,
|
||||
"description": evaluation.description,
|
||||
"evaluation_id": evaluation.id,
|
||||
"jour": evaluation.date_debut or datetime.datetime(1900, 1, 1),
|
||||
"etat": {
|
||||
"blocked": evaluation.is_blocked(),
|
||||
"evalcomplete": etat.is_complete,
|
||||
"nb_notes": etat.nb_notes,
|
||||
"last_modif": last_modif,
|
||||
},
|
||||
"evaluation_id": evaluation.id,
|
||||
"jour": evaluation.date_debut or datetime.datetime(1900, 1, 1),
|
||||
"publish_incomplete": evaluation.publish_incomplete,
|
||||
}
|
||||
|
||||
|
@ -273,8 +273,9 @@ def do_evaluation_etat(
|
||||
def _summarize_evals_etats(etat_evals: list[dict]) -> dict:
|
||||
"""Synthétise les états d'une liste d'évaluations
|
||||
evals: list of mappings (etats),
|
||||
utilise e["etat"]["evalcomplete"], e["etat"]["nb_notes"], e["etat"]["last_modif"]
|
||||
utilise e["blocked"], e["etat"]["evalcomplete"], e["etat"]["nb_notes"], e["etat"]["last_modif"]
|
||||
->
|
||||
nb_evals : nb total qcq soit état
|
||||
nb_eval_completes (= prises en compte)
|
||||
nb_evals_en_cours (= avec des notes, mais pas complete)
|
||||
nb_evals_vides (= sans aucune note)
|
||||
@ -282,14 +283,16 @@ def _summarize_evals_etats(etat_evals: list[dict]) -> dict:
|
||||
|
||||
Une eval est "complete" ssi tous les etudiants *inscrits* ont une note.
|
||||
"""
|
||||
nb_evals_completes, nb_evals_en_cours, nb_evals_vides = 0, 0, 0
|
||||
nb_evals_completes, nb_evals_en_cours, nb_evals_vides, nb_evals_blocked = 0, 0, 0, 0
|
||||
dates = []
|
||||
for e in etat_evals:
|
||||
if e["etat"]["blocked"]:
|
||||
nb_evals_blocked += 1
|
||||
if e["etat"]["evalcomplete"]:
|
||||
nb_evals_completes += 1
|
||||
elif e["etat"]["nb_notes"] == 0:
|
||||
nb_evals_vides += 1
|
||||
else:
|
||||
elif not e["etat"]["blocked"]:
|
||||
nb_evals_en_cours += 1
|
||||
last_modif = e["etat"]["last_modif"]
|
||||
if last_modif is not None:
|
||||
@ -299,6 +302,8 @@ def _summarize_evals_etats(etat_evals: list[dict]) -> dict:
|
||||
last_modif = sorted(dates)[-1] if dates else ""
|
||||
|
||||
return {
|
||||
"nb_evals": len(etat_evals),
|
||||
"nb_evals_blocked": nb_evals_blocked,
|
||||
"nb_evals_completes": nb_evals_completes,
|
||||
"nb_evals_en_cours": nb_evals_en_cours,
|
||||
"nb_evals_vides": nb_evals_vides,
|
||||
|
@ -1235,6 +1235,7 @@ def formsemestre_tableau_modules(
|
||||
and etat["nb_evals_en_cours"] == 0
|
||||
and etat["nb_evals_vides"] == 0
|
||||
and not etat["attente"]
|
||||
and not etat["nb_evals_blocked"] > 0
|
||||
):
|
||||
tr_classes = f"formsemestre_status_green{fontorange}"
|
||||
else:
|
||||
@ -1243,6 +1244,8 @@ def formsemestre_tableau_modules(
|
||||
tr_classes += " modimpl_attente"
|
||||
if not mod_is_conforme:
|
||||
tr_classes += " modimpl_non_conforme"
|
||||
if etat["nb_evals_blocked"] > 0:
|
||||
tr_classes += " modimpl_has_blocked"
|
||||
H.append(
|
||||
f"""
|
||||
<tr class="{tr_classes}">
|
||||
@ -1284,17 +1287,20 @@ def formsemestre_tableau_modules(
|
||||
ModuleType.SAE,
|
||||
):
|
||||
H.append('<td class="evals">')
|
||||
nb_evals = (
|
||||
etat["nb_evals_completes"]
|
||||
+ etat["nb_evals_en_cours"]
|
||||
+ etat["nb_evals_vides"]
|
||||
)
|
||||
nb_evals = etat["nb_evals"]
|
||||
if nb_evals != 0:
|
||||
if etat["nb_evals_blocked"] > 0:
|
||||
blocked_txt = f""", <span class="nb_evals_blocked">{
|
||||
etat["nb_evals_blocked"]} bloquée{'s'
|
||||
if etat["nb_evals_blocked"] > 1 else ''}</span>"""
|
||||
else:
|
||||
blocked_txt = ""
|
||||
H.append(
|
||||
f"""<a href="{moduleimpl_status_url}"
|
||||
title="les évaluations 'ok' sont celles prises en compte dans les calculs"
|
||||
class="formsemestre_status_link">{nb_evals} prévues,
|
||||
{etat["nb_evals_completes"]} ok</a>"""
|
||||
{etat["nb_evals_completes"]} ok {blocked_txt}
|
||||
</a>"""
|
||||
)
|
||||
if etat["nb_evals_en_cours"] > 0:
|
||||
H.append(
|
||||
|
@ -1821,6 +1821,13 @@ tr.modimpl_non_conforme td, tr.modimpl_attente td {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
tr.modimpl_has_blocked span.nb_evals_blocked {
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
background-color: yellow;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
}
|
||||
table.formsemestre_status a.redlink {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user