From 3b7f2130f3e9e2afa49fb9b68c9a2fd8d3aff0d8 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Mon, 10 Apr 2023 17:38:58 +0200 Subject: [PATCH] Check that notes correspond to someone in the jury, and throw an error if this is not the case Signed-off-by: Emmy D'Anello --- participation/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/participation/views.py b/participation/views.py index 1483d9f..2c25bb7 100644 --- a/participation/views.py +++ b/participation/views.py @@ -810,10 +810,14 @@ class PoolUploadNotesView(VolunteerMixin, FormView, DetailView): pool = self.get_object() parsed_notes = form.cleaned_data['parsed_notes'] - for vr, notes in parsed_notes.items(): + for vr in parsed_notes.keys(): if vr not in pool.juries.all(): form.add_error('file', _("The following user is not registered as a jury:") + " " + str(vr)) + if form.errors: + return self.form_invalid(form) + + for vr, notes in parsed_notes.items(): # There is an observer note for 4-teams pools notes_count = 7 if pool.passages.count() == 4 else 6 for i, passage in enumerate(pool.passages.all()):