From f7db75e1a2b8358445e74f1a5668ea9c3b61a354 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 17 Jan 2022 22:32:44 +0100 Subject: [PATCH] Fix: exception si import notes sur etuds non inscrit --- app/scodoc/sco_exceptions.py | 10 +++++----- app/scodoc/sco_saisie_notes.py | 6 +++--- sco_version.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/scodoc/sco_exceptions.py b/app/scodoc/sco_exceptions.py index d975766efe..dd872a7aab 100644 --- a/app/scodoc/sco_exceptions.py +++ b/app/scodoc/sco_exceptions.py @@ -36,11 +36,6 @@ class ScoException(Exception): pass -class NoteProcessError(ScoException): - "misc errors in process" - pass - - class InvalidEtudId(NoteProcessError): pass @@ -56,6 +51,11 @@ class ScoValueError(ScoException): self.dest_url = dest_url +class NoteProcessError(ScoValueError): + "Valeurs notes invalides" + pass + + class ScoFormatError(ScoValueError): pass diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index 0fa105db8a..d0a5407ddf 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -487,10 +487,10 @@ def notes_add( } for (etudid, value) in notes: 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(f"etudiant {etudid} non inscrit dans ce module") + if (value is not None) and not isinstance(value, float): raise NoteProcessError( - "etudiant %s: valeur de note invalide (%s)" % (etudid, value) + f"etudiant {etudid}: valeur de note invalide ({value})" ) # Recherche notes existantes notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) diff --git a/sco_version.py b/sco_version.py index cab845d19a..23676c26f2 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.1.25" +SCOVERSION = "9.1.26" SCONAME = "ScoDoc"