From e6e9ed7dfa7c8fc4bb7423852d9fd126765d7ca2 Mon Sep 17 00:00:00 2001 From: Ivo Su Date: Tue, 20 Jul 2021 13:20:18 -0400 Subject: [PATCH 1/2] feat: add keypad numbers to correct answer --- package.json | 2 +- src/lib/rt-categorize-html.js | 6 +----- src/trials/interference.js | 11 +---------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index ee94372..c6d80f1 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "email": "ccv-bot@brown.edu", "url": "ccv.brown.edu" }, - "version": "2.0.0", + "version": "2.1.0", "license": "MIT", "private": true, "main": "public/electron.js", diff --git a/src/lib/rt-categorize-html.js b/src/lib/rt-categorize-html.js index 6d71747..ef6d165 100644 --- a/src/lib/rt-categorize-html.js +++ b/src/lib/rt-categorize-html.js @@ -116,17 +116,13 @@ 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 = { diff --git a/src/trials/interference.js b/src/trials/interference.js index 46e092d..33d670b 100644 --- a/src/trials/interference.js +++ b/src/trials/interference.js @@ -10,21 +10,12 @@ const interference = (trial) => { type: 'rt-categorize-html', trial_duration: 1250, 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 - } } } From 8e0a318b3ed1805f266500ba9595620e759a5d52 Mon Sep 17 00:00:00 2001 From: Ivo Su Date: Thu, 29 Jul 2021 13:37:33 -0400 Subject: [PATCH 2/2] fix: add key_answer to trial_data --- src/lib/rt-categorize-html.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/rt-categorize-html.js b/src/lib/rt-categorize-html.js index ef6d165..aaae3fc 100644 --- a/src/lib/rt-categorize-html.js +++ b/src/lib/rt-categorize-html.js @@ -129,7 +129,8 @@ export function rt_categorize_html() { "rt": info.rt, "correct": correct, "stimulus": trial.stimulus, - "key_press": info.key + "key_press": info.key, + "key_answer": trial.key_answer }; display_element.innerHTML = '';