From 107f728852515f182f15e2cd53f14ebec8a0021a Mon Sep 17 00:00:00 2001 From: danielghost Date: Wed, 20 Sep 2023 14:13:24 +0100 Subject: [PATCH] Fix: added answered statement for the confidenceSlider (fixes #26). --- js/statementModel.js | 6 +++++- .../confidenceSliderStatementModel.js | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 js/statements/confidenceSliderStatementModel.js diff --git a/js/statementModel.js b/js/statementModel.js index ba61974..9cc1101 100644 --- a/js/statementModel.js +++ b/js/statementModel.js @@ -8,13 +8,14 @@ define([ './statements/experiencedStatementModel', './statements/mcqStatementModel', './statements/sliderStatementModel', + './statements/confidenceSliderStatementModel', './statements/textInputStatementModel', './statements/matchingStatementModel', './statements/assessmentStatementModel', './statements/resourceItemStatementModel', './statements/favouriteStatementModel', './statements/unfavouriteStatementModel' -], function(Adapt, COMPLETION_STATE, InitializedStatementModel, TerminatedStatementModel, PreferredLanguageStatementModel, CompletedStatementModel, ExperiencedStatementModel, McqStatementModel, SliderStatementModel, TextInputStatementModel, MatchingStatementModel, AssessmentStatementModel, ResourceItemStatementModel, FavouriteStatementModel, UnfavouriteStatementModel) { +], function(Adapt, COMPLETION_STATE, InitializedStatementModel, TerminatedStatementModel, PreferredLanguageStatementModel, CompletedStatementModel, ExperiencedStatementModel, McqStatementModel, SliderStatementModel, ConfidenceSliderStatementModel, TextInputStatementModel, MatchingStatementModel, AssessmentStatementModel, ResourceItemStatementModel, FavouriteStatementModel, UnfavouriteStatementModel) { const StatementModel = Backbone.Model.extend({ @@ -177,6 +178,9 @@ define([ case 'slider': statementClass = SliderStatementModel; break; + case 'confidenceSlider': + statementClass = ConfidenceSliderStatementModel; + break; case 'textinput': statementClass = TextInputStatementModel; break; diff --git a/js/statements/confidenceSliderStatementModel.js b/js/statements/confidenceSliderStatementModel.js new file mode 100644 index 0000000..0686fa7 --- /dev/null +++ b/js/statements/confidenceSliderStatementModel.js @@ -0,0 +1,20 @@ +define([ + './sliderStatementModel' +], function(SliderStatementModel) { + + const ConfidenceSliderStatementModel = SliderStatementModel.extend({ + + getResult: function(model) { + const result = { + completion: model.get('_isComplete'), + response: this.getResponse(model) + }; + + return result; + }, + + }); + + return ConfidenceSliderStatementModel; + +});