1
0
forked from ScoDoc/ScoDoc

Fix: suppression toutes notes évaluations

This commit is contained in:
Emmanuel Viennet 2021-12-17 22:53:34 +01:00
parent 593317a50a
commit 4511951255
2 changed files with 17 additions and 6 deletions

View File

@ -471,7 +471,7 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list
raise ScoValueError("invalid formation_id")
parcours = formation.get_parcours()
is_apc = parcours.APC_SAE
locked = sco_formations.formation_has_locked_sems(formation_id)
locked = formation.has_locked_sems()
if semestre_idx == "all":
semestre_idx = None
else:
@ -541,7 +541,7 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list
if locked:
H.append(
f"""<p class="help">Cette formation est verrouillée car
{len(locked)} semestres verrouillés s'y réferent.
des semestres verrouillés s'y réferent.
Si vous souhaitez modifier cette formation (par exemple pour y ajouter un module),
vous devez:
</p>

View File

@ -408,7 +408,7 @@ def evaluation_suppress_alln(evaluation_id, dialog_confirmed=False):
if not dialog_confirmed:
nb_changed, nb_suppress, existing_decisions = notes_add(
current_user, evaluation_id, notes, do_it=False
current_user, evaluation_id, notes, do_it=False, check_inscription=False
)
msg = (
"<p>Confirmer la suppression des %d notes ? <em>(peut affecter plusieurs groupes)</em></p>"
@ -426,7 +426,11 @@ def evaluation_suppress_alln(evaluation_id, dialog_confirmed=False):
# modif
nb_changed, nb_suppress, existing_decisions = notes_add(
current_user, evaluation_id, notes, comment="effacer tout"
current_user,
evaluation_id,
notes,
comment="effacer tout",
check_inscription=False,
)
assert nb_changed == nb_suppress
H = ["<p>%s notes supprimées</p>" % nb_suppress]
@ -454,7 +458,14 @@ def evaluation_suppress_alln(evaluation_id, dialog_confirmed=False):
return html_sco_header.sco_header() + "\n".join(H) + html_sco_header.sco_footer()
def notes_add(user, evaluation_id: int, notes: list, comment=None, do_it=True) -> tuple:
def notes_add(
user,
evaluation_id: int,
notes: list,
comment=None,
do_it=True,
check_inscription=True,
) -> tuple:
"""
Insert or update notes
notes is a list of tuples (etudid,value)
@ -475,7 +486,7 @@ def notes_add(user, evaluation_id: int, notes: list, comment=None, do_it=True) -
)
}
for (etudid, value) in notes:
if etudid not in inscrits:
if check_inscription and (etudid not in inscrits):
raise NoteProcessError("etudiant non inscrit dans ce module")
if not ((value is None) or (type(value) == type(1.0))):
raise NoteProcessError(