Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/lib/rt-categorize-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also save the key_answer with the trial_data to be safe

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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcmcgrath13 is this what you meant with the above comment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup!

};

display_element.innerHTML = '';
Expand Down
11 changes: 1 addition & 10 deletions src/trials/interference.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down