diff --git a/.changeset/mighty-shrimps-knock.md b/.changeset/mighty-shrimps-knock.md new file mode 100644 index 00000000..5fc3b45f --- /dev/null +++ b/.changeset/mighty-shrimps-knock.md @@ -0,0 +1,10 @@ +--- +"@jspsych-contrib/extension-countdown": patch +"@jspsych-contrib/extension-device-motion": patch +"@jspsych-contrib/extension-mediapipe-face-mesh": patch +"@jspsych-contrib/extension-touchscreen-buttons": patch +"@jspsych-contrib/plugin-corsi-blocks": minor +--- + +Plugin corsi blocks issue 141 +In this updated version, the trial only ends when the response length matches the sequence length, regardless of whether the clicks were correct or not. This allows the user to register an incorrect sequence without ending the trial immediately. diff --git a/packages/plugin-corsi-blocks/examples/example.html b/packages/plugin-corsi-blocks/examples/example.html index 8fe0bc58..ea276f0f 100644 --- a/packages/plugin-corsi-blocks/examples/example.html +++ b/packages/plugin-corsi-blocks/examples/example.html @@ -29,13 +29,13 @@ timeline.push({ type: jsPsychCorsiBlocks, - sequence: [3,1], + sequence: [3,1,2], mode: 'display' }); timeline.push({ type: jsPsychCorsiBlocks, - sequence: [3,1], + sequence: [3,1,2], mode: 'input' }); diff --git a/packages/plugin-corsi-blocks/src/index.ts b/packages/plugin-corsi-blocks/src/index.ts index 63b2867a..7283c6ec 100644 --- a/packages/plugin-corsi-blocks/src/index.ts +++ b/packages/plugin-corsi-blocks/src/index.ts @@ -294,15 +294,14 @@ class CorsiBlocksPlugin implements JsPsychPlugin { display_element .querySelector(`.jspsych-corsi-block[data-id="${id}"]`) .animate(correct_animation, animation_timing); - if (trial_data.response.length == trial.sequence.length) { - trial_data.correct = true; - setTimeout(end_trial, trial.response_animation_duration); // allows animation to finish - } } else { display_element .querySelector(`.jspsych-corsi-block[data-id="${id}"]`) .animate(incorrect_animation, animation_timing); - trial_data.correct = false; + } + // Only end the trial when the response length matches the sequence length + if (trial_data.response.length == trial.sequence.length) { + trial_data.correct = JSON.stringify(trial_data.response) === JSON.stringify(trial.sequence); setTimeout(end_trial, trial.response_animation_duration); // allows animation to finish } };