Fix: front&back saisie note sur DEM

This commit is contained in:
Emmanuel Viennet 2024-03-21 16:42:28 +01:00
parent 03c03f3725
commit 4aa30a40bd
2 changed files with 11 additions and 5 deletions

View File

@ -68,7 +68,6 @@ from app.scodoc import sco_excel
from app.scodoc import sco_formsemestre_inscriptions from app.scodoc import sco_formsemestre_inscriptions
from app.scodoc import sco_groups from app.scodoc import sco_groups
from app.scodoc import sco_groups_view from app.scodoc import sco_groups_view
from app.scodoc import sco_permissions_check
from app.scodoc import sco_undo_notes from app.scodoc import sco_undo_notes
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
from app.scodoc.TrivialFormulator import TrivialFormulator, TF from app.scodoc.TrivialFormulator import TrivialFormulator, TF
@ -531,7 +530,7 @@ def notes_add(
Return: tuple (etudids_changed, nb_suppress, etudids_with_decision) 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]) now = psycopg2.Timestamp(*time.localtime()[:6])
# Vérifie inscription et valeur note # Vérifie inscription et valeur note
@ -541,10 +540,16 @@ def notes_add(
evaluation_id, getallstudents=True, include_demdef=True 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: 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") raise NoteProcessError(f"étudiant {etudid} non inscrit dans ce module")
if (value is not None) and not isinstance(value, float): if (value is not None) and not isinstance(value, float):
log(f"notes_add: {etudid} valeur de note invalide ({value}): aborting")
raise NoteProcessError( raise NoteProcessError(
f"etudiant {etudid}: valeur de note invalide ({value})" f"etudiant {etudid}: valeur de note invalide ({value})"
) )
@ -555,7 +560,6 @@ def notes_add(
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
etudids_changed = [] etudids_changed = []
nb_suppress = 0 nb_suppress = 0
evaluation: Evaluation = Evaluation.query.get_or_404(evaluation_id)
formsemestre: FormSemestre = evaluation.moduleimpl.formsemestre formsemestre: FormSemestre = evaluation.moduleimpl.formsemestre
res: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre) res: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
# etudids pour lesquels il y a une decision de jury et que la note change: # etudids pour lesquels il y a une decision de jury et que la note change:

View File

@ -114,7 +114,9 @@ function paste_text(e) {
.classList.contains("masquer_DEM"); .classList.contains("masquer_DEM");
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
if (!currentInput.disabled) { // skip DEM
currentInput.value = list[i]; currentInput.value = list[i];
}
var evt = document.createEvent("HTMLEvents"); var evt = document.createEvent("HTMLEvents");
evt.initEvent("blur", false, true); evt.initEvent("blur", false, true);
currentInput.dispatchEvent(evt); currentInput.dispatchEvent(evt);