Skip to content

Commit

Permalink
Fix saving feature
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelrahmanDeghedy committed Jan 22, 2024
1 parent 3689e25 commit 391853e
Show file tree
Hide file tree
Showing 2 changed files with 8 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
6 changes: 6 additions & 0 deletions game/views/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@ 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 391853e

Please sign in to comment.