From f95f2e2f4edc5937f00fdeda32a72935b942cae0 Mon Sep 17 00:00:00 2001 From: Abdelrahman Deghedy Date: Tue, 23 Jan 2024 09:51:15 +0000 Subject: [PATCH] fix: 1573-Fix Saving Feature (#1574) * Fix saving feature * Remove extra whitespace * Merge branch 'master' into 1573-fix-saving-feature --- game/static/game/js/game.js | 4 ++-- game/views/level.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/game/static/game/js/game.js b/game/static/game/js/game.js index 1d12d4205..3ef18a762 100644 --- a/game/static/game/js/game.js +++ b/game/static/game/js/game.js @@ -1211,13 +1211,13 @@ ocargo.Game.prototype._setupSaveTab = function () { break } } - var workspace = { name: newName, contents: ocargo.blocklyControl.serialize(), python_contents: ocargo.pythonControl.getCode(), blockly_enabled: BLOCKLY_ENABLED, - python_enabled: PYTHON_ENABLED + python_enabled: PYTHON_ENABLED, + pythonViewEnabled: PYTHON_VIEW_ENABLED } this.saving.saveWorkspace( diff --git a/game/views/level.py b/game/views/level.py index 865edc7b2..a4511b002 100644 --- a/game/views/level.py +++ b/game/views/level.py @@ -360,6 +360,10 @@ def load_workspace(request, workspaceID): def save_workspace(request, workspaceID=None): + request_params = ["name", "contents", "python_contents", "blockly_enabled", "python_enabled", "pythonViewEnabled"] + missing_params = [param for param in request_params if param not in request.POST] + if missing_params != []: + raise Exception("Request missing the following required parameters", missing_params) name = request.POST.get("name") contents = request.POST.get("contents") python_contents = request.POST.get("python_contents")