Skip to content

Commit

Permalink
allow non-0 indexed scoring for surveys. issue #73. (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
YJ-Ren authored Jan 6, 2023
1 parent b7901a9 commit 5fb33aa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tasks/self-report/plugin-survey-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ var jsPsychSurveyTemplate = (function (jspsych) {
default: [],
description: 'If true, the corresponding item will be reverse scored'
},
scoring_index: {
type: jspsych.ParameterType.INT,
pretty_name: 'Scoring index',
decription: 'The minimum item score (e.g. 0 if scoring is 0-indexed)',
default: 0
},
infrequency_items: {
type: jspsych.ParameterType.INT,
array: true,
Expand Down Expand Up @@ -225,7 +231,7 @@ var jsPsychSurveyTemplate = (function (jspsych) {

// Define response values.
var values = [];
for (var j = 0; j < trial.scale.length; j++){ values.push(j); }
for (var j = trial.scoring_index; j < (trial.scale.length + trial.scoring_index); j++){ values.push(j); }
if (trial.reverse[item_order[i]]) { values = values.reverse(); }

// Add response headers (every N items).
Expand Down

0 comments on commit 5fb33aa

Please sign in to comment.