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 <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2023-04-10 17:38:58 +02:00
parent d75c800275
commit 3b7f2130f3
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 5 additions and 1 deletions

View File

@ -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()):