Permalink
Browse files

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
  • Loading branch information...
jonathanoroberts authored and peircej committed May 18, 2017
1 parent dcd0efb commit f903210816b9ffbcd16f3fbd209cf1b52469a5ad
Showing with 6 additions and 4 deletions.
  1. +6 −4 psychopy/app/builder/components/keyboard/__init__.py
@@ -490,10 +490,12 @@ def writeRoutineEndCodeJS(self, buff):
if self.params['storeCorrect'].val: # check for correct NON-repsonse
code = ("// was no response the correct answer?!\n"
"if (psychoJS.str(%(correctAns)s).toLowerCase() == 'none') {\n"
" %(name)s.corr = 1 // correct non-response\n"
"} else {\n"
" %(name)s.corr = 0 // failed to respond (incorrectly)\n"
"if (%(name)s.keys == undefined) {\n"
" if (psychoJS.str(%(correctAns)s).toLowerCase() == 'none') {\n"
" %(name)s.corr = 1 // correct non-response\n"
" } else {\n"
" %(name)s.corr = 0 // failed to respond (incorrectly)\n"
" }\n"
"}\n"
% self.params)

0 comments on commit f903210

Please sign in to comment.