Skip to content

Commit

Permalink
bugfix: #1114
Browse files Browse the repository at this point in the history
standard question view (new version) functions were not being called by the compatibility layer.

the checking statement, line 484, was checking if the required function on the current view prototype was the same as the compatibility layer function - which it always will have been because the compatibility extension view was always an extension of the question view.

i have stopped the compatibility extension including the question view prototype functions when the comparison takes place so that line 484 will not be comparing "setQuestionAsSubmitted" and "checkQuestionCompletion" to itself.
  • Loading branch information
oliverfoster authored Jun 23, 2016
1 parent bbded7f commit 0ccdab9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/core/js/views/questionView.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ define([
* Remove this section in when all components use questionModel and there is no need to have model behaviour in the questionView
*/

var viewOnlyCompatibleQuestionView = QuestionView.extend({
var viewOnlyCompatibleQuestionView = {

/* All of these functions have been moved to the questionModel.js file.
* On the rare occasion that they have not been overridden by the component and
Expand Down Expand Up @@ -481,18 +481,19 @@ define([
if (!this.constructor.prototype[checkForFunction]) return false; //questionModel

//if the function DOES exist on the view and MATCHES the compatibility function above, use the model only
if (this.constructor.prototype[checkForFunction] === viewOnlyCompatibleQuestionView.prototype[checkForFunction]) return false; //questionModel
if (this.constructor.prototype[checkForFunction] === viewOnlyCompatibleQuestionView[checkForFunction]) return false; //questionModel

//if the function DOES exist on the view and does NOT match the compatibility function above, use the view function
return true; //questionView
}

}, {
};

//return question view class extended with the compatibility layer
return QuestionView.extend(viewOnlyCompatibleQuestionView, {
_isQuestionType: true
});

return viewOnlyCompatibleQuestionView;

/*END OF BACKWARDS COMPATIBILITY SECTION*/

});

0 comments on commit 0ccdab9

Please sign in to comment.