Skip to content

Commit 0c3cea2

Browse files
committed
BF: JS outputs from Builder not detecting non-response correctly
Go/no-go tasks weren't working as a result
1 parent a873397 commit 0c3cea2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

psychopy/experiment/components/keyboard/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -490,16 +490,16 @@ def writeRoutineEndCodeJS(self, buff):
490490

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

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

0 commit comments

Comments
 (0)