Fix: exception si import notes sur etuds non inscrit

This commit is contained in:
Emmanuel Viennet 2022-01-17 22:32:44 +01:00
parent 831d14cf7d
commit f7db75e1a2
3 changed files with 9 additions and 9 deletions

View File

@ -36,11 +36,6 @@ class ScoException(Exception):
pass pass
class NoteProcessError(ScoException):
"misc errors in process"
pass
class InvalidEtudId(NoteProcessError): class InvalidEtudId(NoteProcessError):
pass pass
@ -56,6 +51,11 @@ class ScoValueError(ScoException):
self.dest_url = dest_url self.dest_url = dest_url
class NoteProcessError(ScoValueError):
"Valeurs notes invalides"
pass
class ScoFormatError(ScoValueError): class ScoFormatError(ScoValueError):
pass pass

View File

@ -487,10 +487,10 @@ def notes_add(
} }
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):
raise NoteProcessError("etudiant non inscrit dans ce module") raise NoteProcessError(f"etudiant {etudid} non inscrit dans ce module")
if not ((value is None) or (type(value) == type(1.0))): if (value is not None) and not isinstance(value, float):
raise NoteProcessError( raise NoteProcessError(
"etudiant %s: valeur de note invalide (%s)" % (etudid, value) f"etudiant {etudid}: valeur de note invalide ({value})"
) )
# Recherche notes existantes # Recherche notes existantes
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.1.25" SCOVERSION = "9.1.26"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"