From ddf3d73c92f999cfcc974d847b5880eb29bb53e0 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 10 Nov 2021 09:37:45 +0100 Subject: [PATCH] enhance check xls upload notes --- app/scodoc/sco_saisie_notes.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index 81fb5bef..6e19f49f 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -202,11 +202,14 @@ def do_evaluation_upload_xls(): diag.append("Erreur: format invalide ! (pas de ligne evaluation_id)") raise InvalidNoteValue() - eval_id = int(lines[i][0].strip()[1:]) + eval_id_str = lines[i][0].strip()[1:] + try: + eval_id = int(eval_id_str) + except ValueError: + eval_id = None if eval_id != evaluation_id: diag.append( - "Erreur: fichier invalide: le code d'évaluation de correspond pas ! ('%s' != '%s')" - % (eval_id, evaluation_id) + f"Erreur: fichier invalide: le code d'évaluation de correspond pas ! ('{eval_id_str}' != '{evaluation_id}')" ) raise InvalidNoteValue() # --- get notes -> list (etudid, value)