From 4aa30a40bdd7ee55e31dfa3e5560ab61af37c32b Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 21 Mar 2024 16:42:28 +0100 Subject: [PATCH] Fix: front&back saisie note sur DEM --- app/scodoc/sco_saisie_notes.py | 12 ++++++++---- app/static/js/saisie_notes.js | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index 7110d3d22..d298570a6 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -68,7 +68,6 @@ from app.scodoc import sco_excel from app.scodoc import sco_formsemestre_inscriptions from app.scodoc import sco_groups from app.scodoc import sco_groups_view -from app.scodoc import sco_permissions_check from app.scodoc import sco_undo_notes import app.scodoc.notesdb as ndb from app.scodoc.TrivialFormulator import TrivialFormulator, TF @@ -531,7 +530,7 @@ def notes_add( Return: tuple (etudids_changed, nb_suppress, etudids_with_decision) """ - assert evaluation_id is not None + evaluation = Evaluation.get_evaluation(evaluation_id) now = psycopg2.Timestamp(*time.localtime()[:6]) # Vérifie inscription et valeur note @@ -541,10 +540,16 @@ def notes_add( evaluation_id, getallstudents=True, include_demdef=True ) } + # Les étudiants inscrits au semestre ni DEM ni DEF + etudids_actifs = evaluation.moduleimpl.formsemestre.etudids_actifs for etudid, value in notes: - if check_inscription and (etudid not in inscrits): + if check_inscription and ( + (etudid not in inscrits) or (etudid not in etudids_actifs) + ): + log(f"notes_add: {etudid} non inscrit ou DEM/DEF: aborting") raise NoteProcessError(f"étudiant {etudid} non inscrit dans ce module") if (value is not None) and not isinstance(value, float): + log(f"notes_add: {etudid} valeur de note invalide ({value}): aborting") raise NoteProcessError( f"etudiant {etudid}: valeur de note invalide ({value})" ) @@ -555,7 +560,6 @@ def notes_add( cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) etudids_changed = [] nb_suppress = 0 - evaluation: Evaluation = Evaluation.query.get_or_404(evaluation_id) formsemestre: FormSemestre = evaluation.moduleimpl.formsemestre res: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre) # etudids pour lesquels il y a une decision de jury et que la note change: diff --git a/app/static/js/saisie_notes.js b/app/static/js/saisie_notes.js index 7fb223bc5..0f62b0ae1 100644 --- a/app/static/js/saisie_notes.js +++ b/app/static/js/saisie_notes.js @@ -114,7 +114,9 @@ function paste_text(e) { .classList.contains("masquer_DEM"); for (var i = 0; i < list.length; i++) { - currentInput.value = list[i]; + if (!currentInput.disabled) { // skip DEM + currentInput.value = list[i]; + } var evt = document.createEvent("HTMLEvents"); evt.initEvent("blur", false, true); currentInput.dispatchEvent(evt);