Skip to content

Commit

Permalink
rt was not being recorded correctly when continue_after_response was …
Browse files Browse the repository at this point in the history
…false
  • Loading branch information
jodeleeuw committed Dec 7, 2013
1 parent 1c3a0ba commit 07a6673
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions plugins/jspsych-single-stim.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
var trial_complete = false;

var startTime = (new Date()).getTime();

var endTime = -1;

var key_press = -1;

if (!trial.is_html) {
Expand All @@ -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 = {
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 07a6673

Please sign in to comment.