From 4511951255a24de5d31ea06b5cfc1e454cc7219f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 17 Dec 2021 22:53:34 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20suppression=20toutes=20notes=20=C3=A9val?= =?UTF-8?q?uations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_edit_ue.py | 4 ++-- app/scodoc/sco_saisie_notes.py | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index cd5dcb7e..929911f6 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -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"""

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:

diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index c1ba813d..0b5cb3ce 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -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 = ( "

Confirmer la suppression des %d notes ? (peut affecter plusieurs groupes)

" @@ -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 = ["

%s notes supprimées

" % 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(