Permalink
Browse files

BF: JS outputs from Builder not detecting non-response correctly

Go/no-go tasks weren't working as a result
  • Loading branch information...
peircej committed Jan 20, 2019
1 parent a873397 commit 0c3cea2b276c3dc93aedb5e3568ef00b2ee5550c
Showing with 3 additions and 3 deletions.
  1. +3 −3 psychopy/experiment/components/keyboard/__init__.py
@@ -490,16 +490,16 @@ def writeRoutineEndCodeJS(self, buff):

# write the actual code
code = ("\n// check responses\n"
"if (['', [], undefined].indexOf(%(name)s.keys) >= 0) {"
"if (%(name)s.keys === undefined || %(name)s.keys.length === 0) {"
" // No response was made\n"
" %(name)s.keys = undefined;\n"
"}\n\n")
buff.writeIndentedLines(code % self.params)

if self.params['storeCorrect'].val: # check for correct NON-repsonse
code = ("// was no response the correct answer?!\n"
"if (%(name)s.keys == undefined) {\n"
" if (psychoJS.str(%(correctAns)s).toLowerCase() == 'none') {\n"
"if (%(name)s.keys === undefined) {\n"
" if (['None','none',undefined].includes(%(correctAns)s)) {\n"
" %(name)s.corr = 1 // correct non-response\n"
" } else {\n"
" %(name)s.corr = 0 // failed to respond (incorrectly)\n"

0 comments on commit 0c3cea2

Please sign in to comment.