Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: Check whether counterbalancer is completed *before* attempting to get a group #6923

Draft
wants to merge 1 commit into
base: release
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
BF: Check whether counterbalancer is completed *before* attempting to…
… get a group
  • Loading branch information
Todd OST committed Oct 18, 2024
commit e7415a5143c2fc734cc02f1e0fc7cc5aa0a56c30
23 changes: 13 additions & 10 deletions psychopy/experiment/routines/counterbalance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,19 @@ def writeRoutineBeginCodeJS(self, buff, modular=True):
"}\n"
)
buff.writeIndentedLines(code % self.params)

# if ending experiment on depletion, write the code to do so
if self.params['endExperimentOnDepletion']:
code = (
"// if slots and repeats are fully depleted, end the experiment now\n"
"const %(name)sStatus = await psychoJS.shelf.counterbalanceStatus(\n"
" ['%(name)s', '@designer', '@experiment']\n"
");\n"
"if (%(name)sStatus.finished) {\n"
" quitPsychoJS('No more slots remaining for this study.', true)\n"
"}\n"
)
buff.writeIndentedLines(code % self.params)
# do actual counterbalancing
code = (
"\n"
"// get counterbalancing group \n"
Expand All @@ -273,15 +285,6 @@ def writeRoutineBeginCodeJS(self, buff, modular=True):
"});\n"
)
buff.writeIndentedLines(code % self.params)
# if ending experiment on depletion, write the code to do so
if self.params['endExperimentOnDepletion']:
code = (
"// if slots and repeats are fully depleted, end the experiment now\n"
"if (%(name)s.finished) {\n"
" quitPsychoJS('No more slots remaining for this study.', true)\n"
"}\n"
)
buff.writeIndentedLines(code % self.params)
# save data
if self.params['saveData']:
code = (
Expand Down
Loading