forked from ScoDoc/DocScoDoc
améliore gestion erreur saisies de notes
This commit is contained in:
parent
f0d641a31e
commit
1b8186e69b
@ -45,6 +45,7 @@ from app.scodoc.sco_exceptions import (
|
||||
AccessDenied,
|
||||
InvalidNoteValue,
|
||||
NoteProcessError,
|
||||
ScoGenError,
|
||||
ScoValueError,
|
||||
)
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
@ -72,13 +73,16 @@ def convert_note_from_string(
|
||||
note_max,
|
||||
note_min=scu.NOTES_MIN,
|
||||
etudid=None,
|
||||
absents=[],
|
||||
tosuppress=[],
|
||||
invalids=[],
|
||||
absents=None,
|
||||
tosuppress=None,
|
||||
invalids=None,
|
||||
):
|
||||
"""converti une valeur (chaine saisie) vers une note numérique (float)
|
||||
Les listes absents, tosuppress et invalids sont modifiées
|
||||
"""
|
||||
absents = absents or []
|
||||
tosuppress = tosuppress or []
|
||||
invalids = invalids or []
|
||||
invalid = False
|
||||
note_value = None
|
||||
note = note.replace(",", ".")
|
||||
@ -179,7 +183,6 @@ def do_evaluation_upload_xls():
|
||||
# Check access
|
||||
# (admin, respformation, and responsable_id)
|
||||
if not sco_permissions_check.can_edit_notes(authuser, E["moduleimpl_id"]):
|
||||
# XXX imaginer un redirect + msg erreur
|
||||
raise AccessDenied("Modification des notes impossible pour %s" % authuser)
|
||||
#
|
||||
diag, lines = sco_excel.excel_file_to_list(vals["notefile"])
|
||||
@ -573,12 +576,13 @@ def _notes_add(user, evaluation_id: int, notes: list, comment=None, do_it=True):
|
||||
except:
|
||||
log("*** exception in _notes_add")
|
||||
if do_it:
|
||||
cnx.rollback() # abort
|
||||
# inval cache
|
||||
sco_cache.invalidate_formsemestre(
|
||||
formsemestre_id=M["formsemestre_id"]
|
||||
) # > modif notes (exception)
|
||||
cnx.rollback() # abort
|
||||
raise # re-raise exception
|
||||
sco_cache.EvaluationCache.delete(evaluation_id)
|
||||
raise ScoGenError("Erreur enregistrement note: merci de ré-essayer")
|
||||
if do_it:
|
||||
cnx.commit()
|
||||
sco_cache.invalidate_formsemestre(
|
||||
@ -588,7 +592,7 @@ def _notes_add(user, evaluation_id: int, notes: list, comment=None, do_it=True):
|
||||
return nb_changed, nb_suppress, existing_decisions
|
||||
|
||||
|
||||
def saisie_notes_tableur(evaluation_id, group_ids=[]):
|
||||
def saisie_notes_tableur(evaluation_id, group_ids=()):
|
||||
"""Saisie des notes via un fichier Excel"""
|
||||
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if not evals:
|
||||
|
Loading…
Reference in New Issue
Block a user