diff --git a/game/end_to_end_tests/selenium_test_case.py b/game/end_to_end_tests/selenium_test_case.py index e92e0d4ef..a94c157a7 100644 --- a/game/end_to_end_tests/selenium_test_case.py +++ b/game/end_to_end_tests/selenium_test_case.py @@ -41,6 +41,6 @@ def tearDownClass(cls): def __call__(self, result=None): if hasattr(self, "selenium"): - for width in getattr(settings, "SELENIUM_WIDTHS", [1024]): + for width in getattr(settings, "SELENIUM_WIDTHS", [1624]): self.selenium.set_window_size(width, 1024) return super(SeleniumTestCase, self).__call__(result) diff --git a/game/static/game/js/model.js b/game/static/game/js/model.js index 9bb5b901f..61753b1e5 100644 --- a/game/static/game/js/model.js +++ b/game/static/game/js/model.js @@ -151,17 +151,17 @@ ocargo.Model.prototype.getPreviousCoordinate = function() { ocargo.Model.prototype.moveVan = function(nextNode, action) { //Crash? - var previousNodeCow = this.getCowForNode(this.van.getPosition().currentNode, ocargo.Cow.ACTIVE); - var collisionWithCow = previousNodeCow && nextNode !== this.van.getPosition().currentNode; + let previousNodeCow = this.getCowForNode(this.van.getPosition().currentNode, ocargo.Cow.ACTIVE); + let collisionWithCow = previousNodeCow && nextNode !== this.van.getPosition().currentNode; - if(collisionWithCow) { + if (collisionWithCow) { handleCrash(this, gettext('You ran into a cow! Keep in mind that cows can appear anywhere on the map.'), 'COLLISION_WITH_COW', 'collision with cow van move action: '); return false; } - var offRoad = nextNode === null; - var offRoadPopupMessage = function(correctSteps){ + let offRoad = nextNode === null; + let offRoadPopupMessage = function(correctSteps){ if (correctSteps === 0) { return gettext('Your first move was a crash. What went wrong?'); } @@ -184,6 +184,8 @@ ocargo.Model.prototype.moveVan = function(nextNode, action) { failures: this.failures, pythonWorkspace: ocargo.pythonControl.getCode() }); + ocargo.game.sendAttempt(0); + ocargo.animation.appendAnimation({ type: 'popup', popupType: 'FAIL', @@ -211,8 +213,10 @@ ocargo.Model.prototype.moveVan = function(nextNode, action) { return false; } - var light = this.getTrafficLightForNode(this.van.getPosition()); + let light = this.getTrafficLightForNode(this.van.getPosition()); if (light !== null && light.getState() === ocargo.TrafficLight.RED && nextNode !== light.controlledNode) { + ocargo.game.sendAttempt(0); + // Ran a red light ocargo.event.sendEvent("LevelThroughRedLight", { levelName: LEVEL_NAME, defaultLevel: DEFAULT_LEVEL, @@ -269,6 +273,7 @@ ocargo.Model.prototype.moveVan = function(nextNode, action) { function handleCrash(model, popupMessage, vanAction, actionDescription) { model.van.crashStatus = 'CRASHED'; + ocargo.game.sendAttempt(0); ocargo.animation.appendAnimation({ type: 'callable', diff --git a/game/static/game/js/program.js b/game/static/game/js/program.js index 0d2bc705d..5e8832aa7 100644 --- a/game/static/game/js/program.js +++ b/game/static/game/js/program.js @@ -28,7 +28,7 @@ ocargo.Thread = function(program) { }; ocargo.Thread.prototype.run = function(model) { - var failed = false; + let failed = false; while (!failed && this.canStep()) { failed = !this.step(model); } @@ -39,8 +39,8 @@ ocargo.Thread.prototype.run = function(model) { ocargo.Thread.prototype.step = function(model) { // check if any event condition is true - for (var i=0; i MAX_EXECUTION_STEPS) { + ocargo.game.sendAttempt(0); // alert user to likely infinite loop ocargo.animation.appendAnimation({ type: 'popup', @@ -63,14 +65,14 @@ ocargo.Thread.prototype.step = function(model) { return false; } - var successful = true; + let successful = true; if (commandToProcess) { successful = commandToProcess.execute(this, model); } if (!successful) { // Program crashed, queue a block highlight event - var block = commandToProcess.block; + let block = commandToProcess.block; queueHighlightIncorrect(model, block); return false; } diff --git a/game/templates/game/level_selection.html b/game/templates/game/level_selection.html index abd979286..187927f0d 100644 --- a/game/templates/game/level_selection.html +++ b/game/templates/game/level_selection.html @@ -70,7 +70,7 @@
-

Blocky levels

+

Blockly levels

The first set of levels use Blockly to slowly introduce you to Python. You can read more about Blockly here.
diff --git a/game/views/level.py b/game/views/level.py index 6f4d310ec..38202046b 100644 --- a/game/views/level.py +++ b/game/views/level.py @@ -250,7 +250,6 @@ def submit_attempt(request): if attempt: attempt.score = float(request.POST.get("score")) attempt.workspace = request.POST.get("workspace") - attempt.workspace = request.POST.get("workspace") attempt.python_workspace = request.POST.get("python_workspace") record_best_attempt(attempt)