Commit d95f1095 authored by Anton Akhmerov's avatar Anton Akhmerov
Browse files

Merge branch '519-add-problem' into 'master'

Only check problem size for templated exams

Closes #519

See merge request zesje/zesje!309
parents e375ce64 230811cb
...@@ -97,10 +97,11 @@ class Problems(Resource): ...@@ -97,10 +97,11 @@ class Problems(Resource):
msg = f"Exam with id {exam_id} doesn't exist" msg = f"Exam with id {exam_id} doesn't exist"
return dict(status=400, message=msg), 400 return dict(status=400, message=msg), 400
page_size = current_app.config['PAGE_FORMATS'][current_app.config['PAGE_FORMAT']] if exam.layout == ExamLayout.templated:
if not (0 <= args['x'] < args['width'] + args['x'] < page_size[0] page_size = current_app.config['PAGE_FORMATS'][current_app.config['PAGE_FORMAT']]
and 0 <= args['y'] < args['height'] + args['y'] < page_size[1]): if not (0 <= args['x'] < args['width'] + args['x'] < page_size[0]
return dict(status=409, message='Problem size exceeds the page size.'), 409 and 0 <= args['y'] < args['height'] + args['y'] < page_size[1]):
return dict(status=409, message='Problem size exceeds the page size.'), 409
widget = ProblemWidget( widget = ProblemWidget(
x=args['x'], x=args['x'],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment