From 07a667307b709f8e5d4721a5e6077c3d8370f807 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sat, 7 Dec 2013 15:02:51 -0500 Subject: [PATCH] rt was not being recorded correctly when continue_after_response was false --- plugins/jspsych-single-stim.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/jspsych-single-stim.js b/plugins/jspsych-single-stim.js index 8e4b1e663b..b3988602d7 100644 --- a/plugins/jspsych-single-stim.js +++ b/plugins/jspsych-single-stim.js @@ -56,7 +56,8 @@ var trial_complete = false; var startTime = (new Date()).getTime(); - + var endTime = -1; + var key_press = -1; if (!trial.is_html) { @@ -78,8 +79,10 @@ } var cont_function = function() { - var endTime = (new Date()).getTime(); - var rt = (endTime - startTime); + var rt = -1; + if (endTime != -1) { + rt = (endTime - startTime); + } trial_complete = true; var trial_data = { @@ -109,6 +112,9 @@ if (flag) { key_press = e.which; + // record rt + endTime = (new Date()).getTime(); + // after a valid response, the stimulus will have the CSS class 'responded' // which can be used to provide visual feedback that a response was recorded $("#ss").addClass('responded');