Skip to content

Commit

Permalink
fix: 1573-Fix Saving Feature (#1574)
Browse files Browse the repository at this point in the history
* Fix saving feature

* Remove extra whitespace

* Merge branch 'master' into 1573-fix-saving-feature
  • Loading branch information
AbdelrahmanDeghedy authored Jan 23, 2024
1 parent 03769d0 commit f95f2e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions game/static/game/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions game/views/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f95f2e2

Please sign in to comment.