Skip to content

Commit 29a364c

Browse files
authored
Merge pull request #13 from compmem/dylan_is_stuck
Mid Collection updates and bug fixes
2 parents 6ea21da + efd9a5e commit 29a364c

File tree

13 files changed

+226
-206
lines changed

13 files changed

+226
-206
lines changed

config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# the executable is prepared for distribution.
2121
WORKER_ID_PLACEHOLDER_VALUE = '"------------------------------------------------".---------------------------'
2222
EXP_NAME = "SUPREMEMOOD"
23+
TASKGET_TRIES=3
2324

2425
BACKGROUND_COLOR = (.35, .35, .35, 1.0)
2526

custom_startup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ def InputSubject(self):
7878
background_normal="",
7979
background_color=INFO_OUTLINE_COLOR,
8080
disabled=True)
81+
esc_lbl = Label(text="Press 'Shift' + 'Esc' if you need to exit this screen.", center_x=recin.center_x,
82+
top=recin.bottom - s(10),
83+
font_size=s(INFO_FONT_SIZE))
8184
with Serial():
8285
with While(
8386
(Ref.object(codeIn.text).__len__() < 4)

error_screen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
@Subroutine
55
def error_screen(self, error, message):
6-
with BoxLayout(orientation='vertical', spacing=20):
6+
with BoxLayout(orientation='vertical', spacing=20, pos=[self.exp.screen.width/2, self.exp.screen.height/4]):
77
Label(name="error_details",
88
text=error,
99
text_size=(scale(700), None), font_size=scale(SSI_FONT_SIZE),

main.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# General imports
22
import os
33
import sys
4-
from pathlib import Path
5-
from hashlib import blake2b
64
# Smile imports
75
from smile.common import Experiment, Log, Wait, Func, UntilDone, \
86
Label, Loop, If, Elif, Else, KeyPress, Ref, \
@@ -75,7 +73,7 @@
7573
scale_down=True, scale_box=(1000, 1000), debug=False,
7674
Touch=False, local_crashlog=True,
7775
cmd_traceback=False, data_dir=WRK_DIR,
78-
working_dir=WRK_DIR, show_splash = False)
76+
working_dir=WRK_DIR, show_splash=False)
7977
exp._code = ''
8078
if CogBatt_config.WORKER_ID_SOURCE == 'EXECUTABLE':
8179
retrieved_worker_id = retrieve_worker_id()
@@ -97,9 +95,14 @@
9795
raise NotImplementedError
9896

9997
# get subject id odd or even to counterbalance CAB
100-
flip_CAB = Func(sid_evenness, Ref.object(exp)._subject).result
98+
exp.FLIP_CAB = Func(sid_evenness, Ref.object(exp)._subject).result
99+
with If(exp.FLIP_CAB):
100+
exp.CAB_RESP_KEYS = {'old': AssBind_config.RESP_KEYS['new'], "new": AssBind_config.RESP_KEYS['old']}
101+
with Else():
102+
exp.CAB_RESP_KEYS = {'old': AssBind_config.RESP_KEYS['old'], "new": AssBind_config.RESP_KEYS['new']}
103+
101104
# take next digit to counterbalance BART
102-
flip_BART = Func(sid_evenness, Ref.object(exp)._subject, True).result
105+
exp.FLIP_BART = Func(sid_evenness, Ref.object(exp)._subject, True).result
103106

104107
with Parallel():
105108
with Serial(blocking=False):
@@ -111,22 +114,27 @@
111114
email=version.__email__)
112115
Wait(.5)
113116
with If(Ref.object(exp).get_var('code_invalid')):
114-
error_screen(error='Invalid task code: ' + Ref(str, exp._code),
115-
message='You entered an incorrect task code, please double check the code '
116-
'listed on the website and try again. If it still does not work '
117-
'please contact Dylan Nielson through Prolific or at [email protected].'
117+
error_screen(error='Invalid combination of Worker ID and Code.',
118+
message='Please double check the Worker ID and Code '
119+
'and try again.'
120+
' Be careful of errors in the Worker ID.'
121+
'\nYou entered: '
122+
'\nWorker ID: ' + Ref.object(exp)._subject +
123+
'\n Code: ' + Ref.object(exp)._vars['_code'] +
124+
'\n\n If it still does not work '
125+
'please contact Dylan Nielson through Prolific.'
118126
)
119127

120128
with If(CogBatt_config.RUNNING_FROM_EXECUTABLE and (CogBatt_config.WORKER_ID_SOURCE != 'USER')):
121129
# Handles case where retrieval of worker id fails
122130
with If(exp.worker_id_dict['status'] == 'error'):
123131
error_screen(error='Failed to Retrieve Identifier: ' + exp.worker_id_dict['content'],
124-
message='Contact Dylan Nielson through Prolific or at [email protected]')
132+
message='Contact Dylan Nielson through Prolific.')
125133
# Handles case where retrieval of worker id is default placeholder
126134
with Elif((exp.worker_id_dict['content'] == CogBatt_config.WORKER_ID_PLACEHOLDER_VALUE)
127135
and (CogBatt_config.API_BASE_URL != 'NOSERVER')):
128136
error_screen(error='Non-Unique Identifier',
129-
message='Contact Dylan Nielson through Prolific or at [email protected]')
137+
message='Contact Dylan Nielson through Prolific')
130138
# Error screen for failed GET request to retrieve blocks
131139
with If(exp.tasks_from_api['status'] == 'error'):
132140
error_screen(error='Failed to retrieve tasks.',
@@ -201,8 +209,7 @@
201209
unzip_dir=unzipdir,
202210
sub_dir=Ref.object(exp)._subject_dir,
203211
block=exp.block_number,
204-
happy_mid=False,
205-
flip_resp=flip_CAB)
212+
happy_mid=False)
206213
with Elif(exp.task_name == "rdm"):
207214
Wait(.5)
208215
RDMExp(RDM_config,
@@ -222,8 +229,7 @@
222229
sub_dir=Ref.object(exp)._session_dir,
223230
practice=True,
224231
task_dir=task2dir,
225-
happy_mid=False,
226-
flip_resp=flip_BART)
232+
happy_mid=False)
227233

228234
Wait(.5)
229235

@@ -306,7 +312,8 @@
306312
' and click the "I have completed the tasks" button.'
307313
'\n\n If you no longer have the page open, click on the task link'
308314
' from Prolific again to return to the webpage.'
309-
'\n\n You wil be redirected to Prolific with your completion code.',
315+
'\n\n You wil be redirected to Prolific with your completion code.'
316+
'\n\n Press escape to close this window.',
310317
text_size=(s(700), None), font_size=s(CogBatt_config.SSI_FONT_SIZE))
311318
with UntilDone():
312319
KeyPress()

0 commit comments

Comments
 (0)