Liens pages évaluation

This commit is contained in:
Emmanuel Viennet 2023-08-30 08:53:36 +02:00
parent 4f40fbd028
commit 828e813b10
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()
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,
moduleimpl_id=modimpl.id,
)}">{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> ")
group_id = sco_groups.get_default_group(modimpl.formsemestre_id)
H.append(
f"""<span class="noprint"><a class="stdlink" href="{url_for(
'assiduites.get_etat_abs_date',
f"""<span class="evallink"><a class="stdlink" href="{url_for(
'assiduites.etat_abs_date',
scodoc_dept=g.scodoc_dept,
group_ids=group_id,
desc=evaluation.description or "",
date_debut=evaluation.date_debut.isoformat(),
date_fin=evaluation.date_fin.isoformat(),
)
}">(absences ce jour)</a></span>"""
}">absences ce jour</a></span>"""
)
else:
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_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"],
)
)

View File

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

View File

@ -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")

View File

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