Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions js/views/appView.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ define([
"width": "0",
"padding": "0"
}, time, function() {
console.log();
$("#mainContainer").trigger('checkAndContinue');
this.remove();
})
},
Expand All @@ -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) {
Expand Down
10 changes: 7 additions & 3 deletions js/views/mainView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -58,8 +58,12 @@ define([

}
},
clickOnAnswer: function(e) {
this.checkAndContinue($(e.target).html());
},
events: {
'click .answer-option':'checkAndContinue'
'click .answer-option': 'clickOnAnswer',
'checkAndContinue': 'checkAndContinue'
}
});

Expand Down