From 828e813b106d6c0f0979b8b20eee2e7489a1ebea Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 30 Aug 2023 08:53:36 +0200 Subject: [PATCH] =?UTF-8?q?Liens=20pages=20=C3=A9valuation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_evaluations.py | 8 ++--- app/scodoc/sco_moduleimpl_status.py | 55 ++++++++++------------------- app/static/css/scodoc.css | 2 +- app/views/assiduites.py | 4 +-- sco_version.py | 2 +- 5 files changed, 27 insertions(+), 44 deletions(-) diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index 900145c29..433f0d445 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -653,7 +653,7 @@ def evaluation_describe(evaluation_id="", edit_in_place=True, link_saisie=True): resp_nomcomplet = responsable.get_nomcomplet() can_edit = modimpl.can_edit_notes(current_user, allow_ens=False) - mod_descr = f"""{modimpl.module.code or ""} {modimpl.module.abbrev or modimpl.module.titre or "?"} @@ -688,15 +688,15 @@ def evaluation_describe(evaluation_id="", edit_in_place=True, link_saisie=True): H.append(f"

Réalisée le {evaluation.descr_date()} ") group_id = sco_groups.get_default_group(modimpl.formsemestre_id) H.append( - f"""(absences ce jour)""" + }">absences ce jour""" ) else: H.append("

sans date ") diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 3cfb4cd86..1bcfd9702 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -50,7 +50,6 @@ from app.scodoc import htmlutils from app.scodoc import sco_cal from app.scodoc import sco_compute_moy from app.scodoc import sco_evaluations -from app.scodoc import sco_evaluation_db from app.scodoc import sco_formsemestre_status from app.scodoc import sco_groups from app.scodoc import sco_moduleimpl @@ -59,19 +58,15 @@ from app.tables import list_etuds # menu evaluation dans moduleimpl -def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str: +def moduleimpl_evaluation_menu(evaluation: Evaluation, nbnotes: int = 0) -> str: "Menu avec actions sur une evaluation" - E = sco_evaluation_db.get_evaluation_dict({"evaluation_id": evaluation_id})[0] - modimpl = sco_moduleimpl.moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0] + modimpl: ModuleImpl = evaluation.moduleimpl + group_id = sco_groups.get_default_group(modimpl.formsemestre_id) + evaluation_id = evaluation.id + can_edit_notes = modimpl.can_edit_notes(current_user, allow_ens=False) + can_edit_notes_ens = modimpl.can_edit_notes(current_user) - group_id = sco_groups.get_default_group(modimpl["formsemestre_id"]) - - if ( - sco_permissions_check.can_edit_notes( - current_user, E["moduleimpl_id"], allow_ens=False - ) - and nbnotes != 0 - ): + if can_edit_notes and nbnotes != 0: sup_label = "Supprimer évaluation impossible (il y a des notes)" else: sup_label = "Supprimer évaluation" @@ -83,9 +78,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str: "args": { "evaluation_id": evaluation_id, }, - "enabled": sco_permissions_check.can_edit_notes( - current_user, E["moduleimpl_id"] - ), + "enabled": can_edit_notes_ens, }, { "title": "Modifier évaluation", @@ -93,9 +86,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str: "args": { "evaluation_id": evaluation_id, }, - "enabled": sco_permissions_check.can_edit_notes( - current_user, E["moduleimpl_id"], allow_ens=False - ), + "enabled": can_edit_notes, }, { "title": sup_label, @@ -103,10 +94,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str: "args": { "evaluation_id": evaluation_id, }, - "enabled": nbnotes == 0 - and sco_permissions_check.can_edit_notes( - current_user, E["moduleimpl_id"], allow_ens=False - ), + "enabled": nbnotes == 0 and can_edit_notes, }, { "title": "Supprimer toutes les notes", @@ -114,9 +102,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str: "args": { "evaluation_id": evaluation_id, }, - "enabled": sco_permissions_check.can_edit_notes( - current_user, E["moduleimpl_id"], allow_ens=False - ), + "enabled": can_edit_notes, }, { "title": "Afficher les notes", @@ -132,21 +118,18 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str: "args": { "evaluation_id": evaluation_id, }, - "enabled": sco_permissions_check.can_edit_notes( - current_user, E["moduleimpl_id"] - ), + "enabled": can_edit_notes_ens, }, { "title": "Absences ce jour", - "endpoint": "assiduites.get_etat_abs_date", + "endpoint": "assiduites.etat_abs_date", "args": { "group_ids": group_id, - "desc": E["description"], - "jour": E["jour"], - "heure_debut": E["heure_debut"], - "heure_fin": E["heure_fin"], + "desc": evaluation.description or "", + "date_debut": evaluation.date_debut.isoformat(), + "date_fin": evaluation.date_fin.isoformat(), }, - "enabled": E["jour"], + "enabled": evaluation.date_debut is not None, }, { "title": "Vérifier notes vs absents", @@ -154,7 +137,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str: "args": { "evaluation_id": evaluation_id, }, - "enabled": nbnotes > 0 and E["jour"], + "enabled": nbnotes > 0 and evaluation.date_debut is not None, }, ] @@ -714,7 +697,7 @@ def _ligne_evaluation( if can_edit_notes: H.append( moduleimpl_evaluation_menu( - evaluation.id, + evaluation, nbnotes=etat["nb_notes"], ) ) diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 92d00c376..9312a5d65 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -1315,7 +1315,7 @@ a.smallbutton { } span.evallink { - font-size: 80%; + margin-left: 16px; font-weight: normal; } diff --git a/app/views/assiduites.py b/app/views/assiduites.py index a944d2ca0..ec8139398 100644 --- a/app/views/assiduites.py +++ b/app/views/assiduites.py @@ -733,10 +733,10 @@ def visu_assiduites_group(): ).build() -@bp.route("/EtatAbsencesDate") +@bp.route("/etat_abs_date") @scodoc @permission_required(Permission.ScoView) -def get_etat_abs_date(): +def etat_abs_date(): """date_debut, date_fin en ISO""" date_debut_str = request.args.get("date_debut") date_fin_str = request.args.get("date_fin") diff --git a/sco_version.py b/sco_version.py index b5137adad..c72a26584 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.6.15" +SCOVERSION = "9.6.16" SCONAME = "ScoDoc"