Liens pages évaluation

This commit is contained in:
Emmanuel Viennet 2023-08-30 08:53:36 +02:00 committed by iziram
parent 2124566487
commit c07a8a5e64
5 changed files with 27 additions and 44 deletions

View File

@ -653,7 +653,7 @@ def evaluation_describe(evaluation_id="", edit_in_place=True, link_saisie=True):
resp_nomcomplet = responsable.get_nomcomplet() resp_nomcomplet = responsable.get_nomcomplet()
can_edit = modimpl.can_edit_notes(current_user, allow_ens=False) can_edit = modimpl.can_edit_notes(current_user, allow_ens=False)
mod_descr = f"""<a href="{url_for("notes.moduleimpl_status", mod_descr = f"""<a class="stdlink" href="{url_for("notes.moduleimpl_status",
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
moduleimpl_id=modimpl.id, moduleimpl_id=modimpl.id,
)}">{modimpl.module.code or ""} {modimpl.module.abbrev or modimpl.module.titre or "?"}</a> )}">{modimpl.module.code or ""} {modimpl.module.abbrev or modimpl.module.titre or "?"}</a>
@ -688,15 +688,15 @@ def evaluation_describe(evaluation_id="", edit_in_place=True, link_saisie=True):
H.append(f"<p>Réalisée le <b>{evaluation.descr_date()}</b> ") H.append(f"<p>Réalisée le <b>{evaluation.descr_date()}</b> ")
group_id = sco_groups.get_default_group(modimpl.formsemestre_id) group_id = sco_groups.get_default_group(modimpl.formsemestre_id)
H.append( H.append(
f"""<span class="noprint"><a class="stdlink" href="{url_for( f"""<span class="evallink"><a class="stdlink" href="{url_for(
'assiduites.get_etat_abs_date', 'assiduites.etat_abs_date',
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
group_ids=group_id, group_ids=group_id,
desc=evaluation.description or "", desc=evaluation.description or "",
date_debut=evaluation.date_debut.isoformat(), date_debut=evaluation.date_debut.isoformat(),
date_fin=evaluation.date_fin.isoformat(), date_fin=evaluation.date_fin.isoformat(),
) )
}">(absences ce jour)</a></span>""" }">absences ce jour</a></span>"""
) )
else: else:
H.append("<p><em>sans date</em> ") H.append("<p><em>sans date</em> ")

View File

@ -50,7 +50,6 @@ from app.scodoc import htmlutils
from app.scodoc import sco_cal from app.scodoc import sco_cal
from app.scodoc import sco_compute_moy from app.scodoc import sco_compute_moy
from app.scodoc import sco_evaluations 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_formsemestre_status
from app.scodoc import sco_groups from app.scodoc import sco_groups
from app.scodoc import sco_moduleimpl from app.scodoc import sco_moduleimpl
@ -59,19 +58,15 @@ from app.tables import list_etuds
# menu evaluation dans moduleimpl # 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" "Menu avec actions sur une evaluation"
E = sco_evaluation_db.get_evaluation_dict({"evaluation_id": evaluation_id})[0] modimpl: ModuleImpl = evaluation.moduleimpl
modimpl = sco_moduleimpl.moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0] 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 can_edit_notes and nbnotes != 0:
if (
sco_permissions_check.can_edit_notes(
current_user, E["moduleimpl_id"], allow_ens=False
)
and nbnotes != 0
):
sup_label = "Supprimer évaluation impossible (il y a des notes)" sup_label = "Supprimer évaluation impossible (il y a des notes)"
else: else:
sup_label = "Supprimer évaluation" sup_label = "Supprimer évaluation"
@ -83,9 +78,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str:
"args": { "args": {
"evaluation_id": evaluation_id, "evaluation_id": evaluation_id,
}, },
"enabled": sco_permissions_check.can_edit_notes( "enabled": can_edit_notes_ens,
current_user, E["moduleimpl_id"]
),
}, },
{ {
"title": "Modifier évaluation", "title": "Modifier évaluation",
@ -93,9 +86,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str:
"args": { "args": {
"evaluation_id": evaluation_id, "evaluation_id": evaluation_id,
}, },
"enabled": sco_permissions_check.can_edit_notes( "enabled": can_edit_notes,
current_user, E["moduleimpl_id"], allow_ens=False
),
}, },
{ {
"title": sup_label, "title": sup_label,
@ -103,10 +94,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str:
"args": { "args": {
"evaluation_id": evaluation_id, "evaluation_id": evaluation_id,
}, },
"enabled": nbnotes == 0 "enabled": nbnotes == 0 and can_edit_notes,
and sco_permissions_check.can_edit_notes(
current_user, E["moduleimpl_id"], allow_ens=False
),
}, },
{ {
"title": "Supprimer toutes les notes", "title": "Supprimer toutes les notes",
@ -114,9 +102,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str:
"args": { "args": {
"evaluation_id": evaluation_id, "evaluation_id": evaluation_id,
}, },
"enabled": sco_permissions_check.can_edit_notes( "enabled": can_edit_notes,
current_user, E["moduleimpl_id"], allow_ens=False
),
}, },
{ {
"title": "Afficher les notes", "title": "Afficher les notes",
@ -132,21 +118,18 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str:
"args": { "args": {
"evaluation_id": evaluation_id, "evaluation_id": evaluation_id,
}, },
"enabled": sco_permissions_check.can_edit_notes( "enabled": can_edit_notes_ens,
current_user, E["moduleimpl_id"]
),
}, },
{ {
"title": "Absences ce jour", "title": "Absences ce jour",
"endpoint": "assiduites.get_etat_abs_date", "endpoint": "assiduites.etat_abs_date",
"args": { "args": {
"group_ids": group_id, "group_ids": group_id,
"desc": E["description"], "desc": evaluation.description or "",
"jour": E["jour"], "date_debut": evaluation.date_debut.isoformat(),
"heure_debut": E["heure_debut"], "date_fin": evaluation.date_fin.isoformat(),
"heure_fin": E["heure_fin"],
}, },
"enabled": E["jour"], "enabled": evaluation.date_debut is not None,
}, },
{ {
"title": "Vérifier notes vs absents", "title": "Vérifier notes vs absents",
@ -154,7 +137,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str:
"args": { "args": {
"evaluation_id": evaluation_id, "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: if can_edit_notes:
H.append( H.append(
moduleimpl_evaluation_menu( moduleimpl_evaluation_menu(
evaluation.id, evaluation,
nbnotes=etat["nb_notes"], nbnotes=etat["nb_notes"],
) )
) )

View File

@ -1315,7 +1315,7 @@ a.smallbutton {
} }
span.evallink { span.evallink {
font-size: 80%; margin-left: 16px;
font-weight: normal; font-weight: normal;
} }

View File

@ -733,10 +733,10 @@ def visu_assiduites_group():
).build() ).build()
@bp.route("/EtatAbsencesDate") @bp.route("/etat_abs_date")
@scodoc @scodoc
@permission_required(Permission.ScoView) @permission_required(Permission.ScoView)
def get_etat_abs_date(): def etat_abs_date():
"""date_debut, date_fin en ISO""" """date_debut, date_fin en ISO"""
date_debut_str = request.args.get("date_debut") date_debut_str = request.args.get("date_debut")
date_fin_str = request.args.get("date_fin") date_fin_str = request.args.get("date_fin")

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.6.15" SCOVERSION = "9.6.16"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"