diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py
index a82cc2b1ea..d6def36973 100644
--- a/app/scodoc/sco_moduleimpl_status.py
+++ b/app/scodoc/sco_moduleimpl_status.py
@@ -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(
- current_user, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"]
+ 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"]
+ )
+ and not sem_locked
+ )
+ can_edit_notes = (
+ sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
+ and not sem_locked
)
- caneditnotes = sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
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:
%s""" % sem["semestre_id"])
else:
H.append(""" | """)
- if not sem["etat"]:
+ if sem_locked:
H.append(scu.icontag("lock32_img", title="verrouillé"))
H.append(""" | """)
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 = (
- """Créer nouvelle évaluation
- Trier par date
- """
- % M
- )
+ if can_edit_evals:
+ top_table_links = f"""Créer nouvelle évaluation
+ Trier par date
+ """
if mod_evals:
H.append(
''
@@ -451,14 +460,14 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
)
# Fleches:
H.append(' ')
- if eval_index != (len(mod_evals) - 1) and caneditevals:
+ if eval_index != (len(mod_evals) - 1) and can_edit_evals:
H.append(
'%s'
% (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(
'%s'
% (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 = (
'%s'
% (eval["evaluation_id"], etat_descr, etat_txt)
@@ -496,7 +505,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
H.append("""""")
H.append("""""" % tr_class)
- if caneditevals:
+ if can_edit_evals:
H.append(
"""%s"""
% (
@@ -506,7 +515,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
),
)
)
- if caneditnotes:
+ if can_edit_notes:
H.append(
"""%s"""
% (
@@ -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(
""""""
% eval
)
H.append(scu.icontag("delete_img", alt="supprimer", title="Supprimer"))
- if caneditevals:
+ if can_edit_evals:
H.append("""""")
elif etat["evalcomplete"]:
H.append(
@@ -561,7 +570,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
else:
H.append(" ")
H.append(' | """)
first_eval = False
#
- if caneditevals or not sem["etat"]:
- H.append("""""")
- if not sem["etat"]:
- H.append("""%s semestre verrouillé""" % scu.icontag("lock32_img"))
- else:
- H.append(top_table_links)
+
+ H.append(""" | """)
+ if sem_locked:
+ H.append(f"""{scu.icontag("lock32_img")} semestre verrouillé""")
+ elif can_edit_evals:
+ H.append(top_table_links)
H.append(
""" |
|