From 0cf3b0a7828d2a2aca7e56809167a4204549a655 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 26 Feb 2024 13:55:04 +0100 Subject: [PATCH] =?UTF-8?q?formsemestre=5Fstatus:=20affiche=20modules=20av?= =?UTF-8?q?ec=20=C3=A9vals=20bloqu=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/comp/res_common.py | 6 ++++-- app/scodoc/sco_evaluations.py | 11 ++++++++--- app/scodoc/sco_formsemestre_status.py | 18 ++++++++++++------ app/static/css/scodoc.css | 7 +++++++ 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/app/comp/res_common.py b/app/comp/res_common.py index 706e37f9..89c0ca2a 100644 --- a/app/comp/res_common.py +++ b/app/comp/res_common.py @@ -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, } diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index 8931faf2..683c5b6f 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -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, diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 8d91bf16..ed76196e 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -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""" @@ -1284,17 +1287,20 @@ def formsemestre_tableau_modules( ModuleType.SAE, ): H.append('') - 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""", { + etat["nb_evals_blocked"]} bloquée{'s' + if etat["nb_evals_blocked"] > 1 else ''}""" + else: + blocked_txt = "" H.append( f"""{nb_evals} prévues, - {etat["nb_evals_completes"]} ok""" + {etat["nb_evals_completes"]} ok {blocked_txt} + """ ) if etat["nb_evals_en_cours"] > 0: H.append( diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 4dbebb4f..c0671169 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -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; }