Skip to content

Commit

Permalink
Merge pull request #127 from adaptlearning/issue/2922
Browse files Browse the repository at this point in the history
fix for 'correct answer' button not being enabled on resume
  • Loading branch information
tomgreenfield authored Oct 19, 2020
2 parents fe00acb + 5ab918b commit 0c23f76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions js/dropdownOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ define(function() {

getNext: function() {
var parent = this.parent();
return parent.options[this.getIndex()+1];
return parent.options[this.getIndex() + 1];
},

getPrevious: function() {
var parent = this.parent();
return parent.options[this.getIndex()-1];
return parent.options[this.getIndex() - 1];
},

getFirst: function() {
Expand All @@ -94,7 +94,7 @@ define(function() {

getLast: function() {
var parent = this.parent();
return parent.options[parent.options.length-1];
return parent.options[parent.options.length - 1];
},

scrollTo: function() {
Expand Down
18 changes: 9 additions & 9 deletions js/matchingModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ define([
QuestionModel.prototype.init.call(this);

this.setupQuestionItemIndexes();
this.checkCanSubmit();
},

setupQuestionItemIndexes: function() {
Expand Down Expand Up @@ -50,6 +49,7 @@ define([
});

this.setQuestionAsSubmitted();
this.checkCanSubmit();
this.markQuestion();
this.setScore();
this.setupFeedback();
Expand All @@ -58,7 +58,7 @@ define([
canSubmit: function() {
// can submit if every item has a selection
var canSubmit = _.every(this.get('_items'), function(item) {
return _.findWhere(item._options, {'_isSelected':true}) !== undefined;
return _.findWhere(item._options, { '_isSelected': true }) !== undefined;
});

return canSubmit;
Expand All @@ -78,15 +78,15 @@ define([
var tempUserAnswer = new Array(this.get('_items').length);

this.get('_items').forEach(function(item, index) {
var optionIndex = _.findIndex(item._options, function(o) {return o._isSelected;});
var optionIndex = _.findIndex(item._options, function(o) { return o._isSelected; });

tempUserAnswer[item._index] = optionIndex;
userAnswer[item._index] = item._options[optionIndex]._index;
}, this);

this.set({
'_userAnswer': userAnswer,
'_tempUserAnswer': tempUserAnswer
_userAnswer: userAnswer,
_tempUserAnswer: tempUserAnswer
});
},

Expand All @@ -105,8 +105,8 @@ define([
numberOfCorrectAnswers++;
item._isCorrect = true;
this.set({
'_numberOfCorrectAnswers': numberOfCorrectAnswers,
'_isAtLeastOneCorrectSelection': true
_numberOfCorrectAnswers: numberOfCorrectAnswers,
_isAtLeastOneCorrectSelection: true
});

}, this);
Expand Down Expand Up @@ -210,7 +210,7 @@ define([
var responses = [];

this.get('_userAnswer').forEach(function(userAnswer, index) {
responses.push((index + 1) + "." + (userAnswer + 1));// convert from 0-based to 1-based counting
responses.push((index + 1) + '.' + (userAnswer + 1));// convert from 0-based to 1-based counting
});

return responses.join('#');
Expand All @@ -221,7 +221,7 @@ define([
* @return {string}
*/
getResponseType: function() {
return "matching";
return 'matching';
}
});

Expand Down

0 comments on commit 0c23f76

Please sign in to comment.