Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preložené hlášky do slovenčiny #375

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions competition/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,17 @@ def upload_solutions_with_points(self, request, pk=None):
"""Nahrá .zip archív s opravenými riešeniami (pdf-kami)."""

if 'file' not in request.data:
raise exceptions.ParseError(detail='No file attached')
raise exceptions.ParseError(detail='Žiaden súbor nebol pripojený')

zfile = request.data['file']

if not zipfile.is_zipfile(zfile):
raise exceptions.ParseError(
detail='Attached file is not a zip file')
detail='Priložený súbor nie je zip')

with zipfile.ZipFile(zfile) as zfile:
if zfile.testzip():
raise exceptions.ParseError(detail='Zip file is corrupted')
raise exceptions.ParseError(detail='Súbor zip je poškodený')

parsed_filenames = []
errors = []
Expand All @@ -394,20 +394,21 @@ def upload_solutions_with_points(self, request, pk=None):
except (IndexError, ValueError, AssertionError):
errors.append({
'filename': filename,
'status': 'Cannot parse file'
'status': 'Nedá sa prečítať názov súboru. Skontroluj, že názov súboru'
'je v tvare BODY-MENO-ID_ULOHY-ID_REGISTRACIE_USERA.pdf'
})
continue
except EventRegistration.DoesNotExist:
errors.append({
'filename': filename,
'status': f'User registration with id {registration_pk} does not exist'
'status': f'Registrácia používateľa s id {registration_pk} neexistuje'
})
continue
except Solution.DoesNotExist:
errors.append({
'filename': filename,
'status': f'Solution with registration id {registration_pk}'
f'and problem id {problem_pk} does not exist'
'status': f'Riešenie pre registráciu používateľa s id {registration_pk}'
f'a úlohy id {problem_pk} neexistuje'
})
continue

Expand Down
Loading