diff --git a/src/lib/rt-categorize-html.js b/src/lib/rt-categorize-html.js index 6d71747..aaae3fc 100644 --- a/src/lib/rt-categorize-html.js +++ b/src/lib/rt-categorize-html.js @@ -116,24 +116,21 @@ export function rt_categorize_html() { // create response function var after_response = function(info) { - // kill any remaining setTimeout handlers jsPsych.pluginAPI.clearAllTimeouts(); // clear keyboard listener jsPsych.pluginAPI.cancelAllKeyboardResponses(); - var correct = false; - if (trial.key_answer === info.key) { - correct = true; - } + const correct = trial.key_answer === info.key - 96 || trial.key_answer === info.key - 48; // save data trial_data = { "rt": info.rt, "correct": correct, "stimulus": trial.stimulus, - "key_press": info.key + "key_press": info.key, + "key_answer": trial.key_answer }; display_element.innerHTML = ''; diff --git a/src/trials/interference.js b/src/trials/interference.js index 0002cb7..6c484e3 100644 --- a/src/trials/interference.js +++ b/src/trials/interference.js @@ -9,21 +9,12 @@ const interference = (trial, experimentConfig) => { type: 'rt-categorize-html', trial_duration: experimentConfig.response_time_limit, on_load: () => pdSpotEncode(code), - key_answer: 48+trial.Correct, + key_answer: trial.Correct, show_stim_with_feedback: false, feedback_duration: 2000, timeout_message: interferenceTrial(lang.prompt.too_slow, true) + photodiodeGhostBox(), stimulus: stimulus, response_ends_trial: true, - on_finish: (data) => { - if (data.key_press !== null) { - data.correct = trial.Correct === data.key_press - 48; - } - else { - data.correct = false; - } - data.code = data.key_press - 48 - } } }