Skip to content

Commit f903210

Browse files
jonathanorobertspeircej
authored andcommitted
Fix JS code for checking of correct non-response
Fix the JS code written at the end of a routine so that it checks to see if it was a non-response before evaluating if the non-response was the correct answer. This fixes a problem where normal correct responses are not written to the data file
1 parent dcd0efb commit f903210

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

psychopy/app/builder/components/keyboard/__init__.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,12 @@ def writeRoutineEndCodeJS(self, buff):
490490

491491
if self.params['storeCorrect'].val: # check for correct NON-repsonse
492492
code = ("// was no response the correct answer?!\n"
493-
"if (psychoJS.str(%(correctAns)s).toLowerCase() == 'none') {\n"
494-
" %(name)s.corr = 1 // correct non-response\n"
495-
"} else {\n"
496-
" %(name)s.corr = 0 // failed to respond (incorrectly)\n"
493+
"if (%(name)s.keys == undefined) {\n"
494+
" if (psychoJS.str(%(correctAns)s).toLowerCase() == 'none') {\n"
495+
" %(name)s.corr = 1 // correct non-response\n"
496+
" } else {\n"
497+
" %(name)s.corr = 0 // failed to respond (incorrectly)\n"
498+
" }\n"
497499
"}\n"
498500
% self.params)
499501

0 commit comments

Comments
 (0)