Fix: éditions evaluation sur moduleimpl_status

This commit is contained in:
Emmanuel Viennet 2022-04-28 07:06:01 +02:00
parent 86ef24586d
commit f740ab8339

View File

@ -210,10 +210,17 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
) # la plus RECENTE en tête
#
caneditevals = sco_permissions_check.can_edit_notes(
sem_locked = not sem["etat"]
can_edit_evals = (
sco_permissions_check.can_edit_notes(
current_user, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"]
)
caneditnotes = sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
and not sem_locked
)
can_edit_notes = (
sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
and not sem_locked
)
arrow_up, arrow_down, arrow_none = sco_groups.get_arrow_icons_tags()
#
module_resp = User.query.get(M["responsable_id"])
@ -264,7 +271,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
H.append("""Semestre: </td><td>%s""" % sem["semestre_id"])
else:
H.append("""</td><td>""")
if not sem["etat"]:
if sem_locked:
H.append(scu.icontag("lock32_img", title="verrouillé"))
H.append("""</td><td class="fichetitre2">""")
if modimpl.module.is_apc():
@ -385,13 +392,15 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
# -------- Tableau des evaluations
top_table_links = ""
if sem["etat"]: # non verrouillé
top_table_links = (
"""<a class="stdlink" href="evaluation_create?moduleimpl_id=%(moduleimpl_id)s">Créer nouvelle évaluation</a>
<a class="stdlink" style="margin-left:2em;" href="module_evaluation_renumber?moduleimpl_id=%(moduleimpl_id)s&redirect=1">Trier par date</a>
if can_edit_evals:
top_table_links = f"""<a class="stdlink" href="{
url_for("notes.evaluation_create", scodoc_dept=g.scodoc_dept, moduleimpl_id=M['moduleimpl_id'])
}">Créer nouvelle évaluation</a>
<a class="stdlink" style="margin-left:2em;" href="{
url_for("notes.module_evaluation_renumber", scodoc_dept=g.scodoc_dept, moduleimpl_id=M['moduleimpl_id'],
redirect=1)
}">Trier par date</a>
"""
% M
)
if mod_evals:
H.append(
'<div class="moduleimpl_evaluations_top_links">'
@ -451,14 +460,14 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
)
# Fleches:
H.append('<span class="eval_arrows_chld">')
if eval_index != (len(mod_evals) - 1) and caneditevals:
if eval_index != (len(mod_evals) - 1) and can_edit_evals:
H.append(
'<a href="module_evaluation_move?evaluation_id=%s&after=0" class="aud">%s</a>'
% (eval["evaluation_id"], arrow_up)
)
else:
H.append(arrow_none)
if (eval_index > 0) and caneditevals:
if (eval_index > 0) and can_edit_evals:
H.append(
'<a href="module_evaluation_move?evaluation_id=%s&after=1" class="aud">%s</a>'
% (eval["evaluation_id"], arrow_down)
@ -487,7 +496,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
etat_descr = "il manque des notes"
else:
etat_txt = ""
if caneditevals and etat_txt:
if can_edit_evals and etat_txt:
etat_txt = (
'<a href="evaluation_edit?evaluation_id=%s" title="%s">%s</a>'
% (eval["evaluation_id"], etat_descr, etat_txt)
@ -496,7 +505,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
H.append("""</th></tr>""")
H.append("""<tr class="%s"><td class="mievr">""" % tr_class)
if caneditevals:
if can_edit_evals:
H.append(
"""<a class="smallbutton" href="evaluation_edit?evaluation_id=%s">%s</a>"""
% (
@ -506,7 +515,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
),
)
)
if caneditnotes:
if can_edit_notes:
H.append(
"""<a class="smallbutton" href="saisie_notes?evaluation_id=%s">%s</a>"""
% (
@ -517,13 +526,13 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
)
)
if etat["nb_notes"] == 0:
if caneditevals:
if can_edit_evals:
H.append(
"""<a class="smallbutton" href="evaluation_delete?evaluation_id=%(evaluation_id)s">"""
% eval
)
H.append(scu.icontag("delete_img", alt="supprimer", title="Supprimer"))
if caneditevals:
if can_edit_evals:
H.append("""</a>""")
elif etat["evalcomplete"]:
H.append(
@ -561,7 +570,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
else:
H.append("&nbsp;")
H.append('</td><td class="mievr_menu">')
if caneditnotes:
if can_edit_notes:
H.append(
moduleimpl_evaluation_menu(
eval["evaluation_id"],
@ -644,7 +653,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
H.append(""")""")
if gr_moyenne["group_id"] in etat["gr_incomplets"]:
H.append("""[<font color="red">""")
if caneditnotes:
if can_edit_notes:
H.append(
"""<a class="redlink" href="saisie_notes?evaluation_id=%s&group_ids:list=%s">incomplet</a></font>]"""
% (eval["evaluation_id"], gr_moyenne["group_id"])
@ -653,24 +662,24 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
H.append("""incomplet</font>]""")
else:
H.append("""<span class="redboldtext">&nbsp; """)
if caneditnotes:
if can_edit_notes:
H.append(
"""<a class="redlink" href="saisie_notes?evaluation_id=%s&group_ids:list=%s">"""
% (eval["evaluation_id"], gr_moyenne["group_id"])
)
H.append("pas de notes")
if caneditnotes:
if can_edit_notes:
H.append("""</a>""")
H.append("</span>")
H.append("""</td></tr>""")
first_eval = False
#
if caneditevals or not sem["etat"]:
H.append("""<tr><td colspan="8">""")
if not sem["etat"]:
H.append("""%s semestre verrouillé""" % scu.icontag("lock32_img"))
else:
if sem_locked:
H.append(f"""{scu.icontag("lock32_img")} semestre verrouillé""")
elif can_edit_evals:
H.append(top_table_links)
H.append(