From e00174aaa6f70ec6fcf14db5f60f75505a377adb Mon Sep 17 00:00:00 2001 From: antoineveldhoven Date: Thu, 30 Mar 2023 09:30:29 +0200 Subject: [PATCH] [FIX] JS Error store_parsons_order (#4193) **Description** Upon submitting the result for a parsons test, a JS Error occurs, level is supplied as an integer in the payload; the store_parsons_order route returns an HTTP 400 whenever the level is not an string instance. **Fixes #4192** **How to test** Go to any level; go to parasons tab; submit a / any answer. **Checklist** - [x] Contains one of the PR categories in the name - [x] Describes changes in the format above - [x] Links to an existing issue or discussion - [x] Has a "How to test" section --- app.py | 4 ++-- website/programs.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 3965ddef1df..93dc3dcc80b 100644 --- a/app.py +++ b/app.py @@ -1767,8 +1767,8 @@ def store_parsons_order(): # Validations if not isinstance(body, dict): return 'body must be an object', 400 - if not isinstance(body.get('level'), str): - return 'level must be a string', 400 + if not isinstance(body.get('level'), int): + return 'level must be an integer', 400 if not isinstance(body.get('exercise'), str): return 'exercise must be a string', 400 if not isinstance(body.get('order'), list): diff --git a/website/programs.py b/website/programs.py index 7ba3cc42df8..d4104af935e 100644 --- a/website/programs.py +++ b/website/programs.py @@ -182,8 +182,6 @@ def save_program(self, user): if not body.get("force_save", True): return jsonify({"parse_error": True, "message": gettext("save_parse_warning")}) - print('Going into logic') - program = self.logic.store_user_program( program_id=program_id, level=body['level'],