diff --git a/js/views/appView.js b/js/views/appView.js index 2db9d3b..c4c8291 100644 --- a/js/views/appView.js +++ b/js/views/appView.js @@ -75,6 +75,8 @@ define([ "width": "0", "padding": "0" }, time, function() { + console.log(); + $("#mainContainer").trigger('checkAndContinue'); this.remove(); }) }, @@ -92,8 +94,8 @@ define([ */ answerQuestion: function(event, isRightAnswer) { // Stop timer - this.countDown.clear().run() - // @TODO User boolean argument to determine if question was answered correctly + this.countDown.clear().run(); + // @TODO Use boolean argument to determine if question was answered correctly }, endStage: function(event) { diff --git a/js/views/mainView.js b/js/views/mainView.js index ebc29c0..999b40f 100644 --- a/js/views/mainView.js +++ b/js/views/mainView.js @@ -15,12 +15,12 @@ define([ this.$el.html(_this.template); }, - checkAndContinue: function(e) { + checkAndContinue: function(value) { // Once an attempt is made, a result object is returned. // This object contains information about the // correctness of the answer choice. - var result = MathBeast.attempt($(e.target).html()); + var result = MathBeast.attempt(value); // Calling the answerQuestion event will clear the timer this.$el.trigger("answerQuestion", result.rightAnswer); @@ -58,8 +58,12 @@ define([ } }, + clickOnAnswer: function(e) { + this.checkAndContinue($(e.target).html()); + }, events: { - 'click .answer-option':'checkAndContinue' + 'click .answer-option': 'clickOnAnswer', + 'checkAndContinue': 'checkAndContinue' } });