From 5fb33aaab603b8155481e58b8492f195c0ec44e3 Mon Sep 17 00:00:00 2001 From: YJ-Ren <37371038+YJ-Ren@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:55:01 -0500 Subject: [PATCH] allow non-0 indexed scoring for surveys. issue #73. (#74) --- tasks/self-report/plugin-survey-template.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasks/self-report/plugin-survey-template.js b/tasks/self-report/plugin-survey-template.js index 2be1951..bb12baf 100644 --- a/tasks/self-report/plugin-survey-template.js +++ b/tasks/self-report/plugin-survey-template.js @@ -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, @@ -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).