Skip to content

Commit

Permalink
Fix: added _answered_ statement for the confidenceSlider - excludes `…
Browse files Browse the repository at this point in the history
…score` and `success` from the `result`. (fixes #26). (#27)
  • Loading branch information
danielghost authored Sep 20, 2023
1 parent 848b2eb commit e6c4bdb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/statementModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({

Expand Down Expand Up @@ -177,6 +178,9 @@ define([
case 'slider':
statementClass = SliderStatementModel;
break;
case 'confidenceSlider':
statementClass = ConfidenceSliderStatementModel;
break;
case 'textinput':
statementClass = TextInputStatementModel;
break;
Expand Down
20 changes: 20 additions & 0 deletions js/statements/confidenceSliderStatementModel.js
Original file line number Diff line number Diff line change
@@ -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;

});

0 comments on commit e6c4bdb

Please sign in to comment.