from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import random class MyPage(Page): pass class Results(Page): pass class Introduction(Page): form_model = 'player' form_fields = ['start_seconds','current_task','time_Introduction'] def is_displayed(self): return self.round_number == 1 def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } # class WhoDoYouKnow1(Page): # live_method = 'live_names1' # form_model = 'player' # form_fields = ['current_task'] # class WhoDoYouKnow2(Page): # live_method = 'live_names2' # form_model = 'player' # form_fields = ['current_task'] # class WhoDoYouKnow3(Page): # live_method = 'live_names3' # form_model = 'player' # form_fields = ['current_task'] # class WhoDoYouKnow4(Page): # live_method = 'live_names4' # form_model = 'player' # form_fields = ['current_task'] # class Instructions_Referrals(Page): # form_model = 'player' # form_fields = ['current_task'] # live_method = 'live_names4' class NextActivity(Page): form_model = 'player' form_fields = ['current_task'] def is_displayed(self): return self.round_number in self.participant.vars['task_rounds']['NextActivity'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } # class Referral1(Page): # form_model = 'player' # form_fields = ['ref1_1','ref1_2','ref1_3','ref1_4','ref1_5','ref1_6','ref1_7','ref1_8','current_task'] # timeout_seconds = 300 # class Referral2(Page): # form_model = 'player' # form_fields = ['ref2_1','ref2_2','ref2_3','ref2_4','ref2_5','ref2_6','ref2_7','ref2_8','current_task'] # timeout_seconds = 300 # class Referral3(Page): # form_model = 'player' # form_fields = ['ref3_1','ref3_2','ref3_3','ref3_4','ref3_5','ref3_6','ref3_7','ref3_8','current_task'] # timeout_seconds = 300 # class Referral4(Page): # form_model = 'player' # form_fields = ['ref4_1','ref4_2','ref4_3','ref4_4','ref4_5','ref4_6','ref4_7','ref4_8','current_task'] # timeout_seconds = 300 # class GetContactInfo(Page): # form_model = 'player' # form_fields =['current_task','ref1_1_phone','ref1_1_email','ref1_2_phone','ref1_2_email','ref1_3_phone','ref1_3_email','ref1_4_phone','ref1_4_email','ref1_5_phone','ref1_5_email','ref1_6_phone','ref1_6_email','ref1_7_phone','ref1_7_email','ref1_8_phone','ref1_8_email','ref2_1_phone','ref2_1_email','ref2_2_phone','ref2_2_email','ref2_3_phone','ref2_3_email','ref2_4_phone','ref2_4_email','ref2_5_phone','ref2_5_email','ref2_6_phone','ref2_6_email','ref2_7_phone','ref2_7_email','ref2_8_phone','ref2_8_email','ref3_1_phone','ref3_1_email','ref3_2_phone','ref3_2_email','ref3_3_phone','ref3_3_email','ref3_4_phone','ref3_4_email','ref3_5_phone','ref3_5_email','ref3_6_phone','ref3_6_email','ref3_7_phone','ref3_7_email','ref3_8_phone','ref3_8_email','ref4_1_phone','ref4_1_email','ref4_2_phone','ref4_2_email','ref4_3_phone','ref4_3_email','ref4_4_phone','ref4_4_email','ref4_5_phone','ref4_5_email','ref4_6_phone','ref4_6_email','ref4_7_phone','ref4_7_email','ref4_8_phone','ref4_8_email'] class Instructions_Slider(Page): form_model = 'player' form_fields = ['current_task','time_Instructions_Slider'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['Instructions_Slider'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } class Example(Page): form_model = 'player' form_fields = ['current_task','time_Example'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['Example'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } class ExampleTask(Page): form_model = 'player' form_fields = ['example_task','current_task','time_ExampleTask'] def vars_for_template(self): return { 'answer_range': list(range(-250, 300, 50)), #'answer_range': self.session.config['answer_range'] # 'first_order_only': self.session.config['panama_lab_experiment'], 'prize': 15, 'current_task': self.participant.vars['page_num'] } def before_next_page(self): self.participant.vars['example_task'] = self.player.example_task self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['ExampleTask'] class ExampleTask2(Page): form_model = 'player' form_fields = ['current_task','time_ExampleTask2'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['ExampleTask2'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } class Instructions_Slider2(Page): form_model = 'player' form_fields = ['current_task','time_Instructions_Slider2'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['Instructions_Slider2'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } class FirstOrderAbility(Page): form_model = 'player' form_fields = ['first_order_ability','current_task','time_FirstOrderAbility'] timeout_seconds = 300 def vars_for_template(self): return { 'answer_range': list(range(-5, 6, 1)), #'answer_range': self.session.config['answer_range'] # 'first_order_only': self.session.config['panama_lab_experiment'], 'prize': 15, 'current_task': self.participant.vars['page_num'] } def before_next_page(self): self.participant.vars['first_order_ability'] = self.player.first_order_ability self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['FirstOrderAbility'] class FirstOrderAbilityIT(Page): form_model = 'player' form_fields = ['first_order_ability_IT','current_task','time_FirstOrderAbilityIT'] timeout_seconds = 300 def vars_for_template(self): return { 'answer_range': list(range(-5, 6, 1)), #'answer_range': self.session.config['answer_range'] # 'first_order_only': self.session.config['panama_lab_experiment'], 'prize': 15, 'current_task': self.participant.vars['page_num'] } def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] self.participant.vars['first_order_ability'] = self.player.first_order_ability def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['FirstOrderAbilityIT'] class FirstOrderPreferences(Page): form_model = 'player' form_fields = ['first_order_preferences','current_task','time_FirstOrderPreferences'] timeout_seconds = 300 def vars_for_template(self): return { 'answer_range': list(range(-5, 6, 1)), #'answer_range': self.session.config['answer_range'] # 'first_order_only': self.session.config['panama_lab_experiment'], 'prize': 15, 'current_task': self.participant.vars['page_num'] } def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] self.participant.vars['first_order_ability'] = self.player.first_order_ability def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['FirstOrderPreferences'] class SecondOrderAbilityW(Page): form_model = 'player' form_fields = ['second_order_ability_w','current_task','time_SecondOrderAbilityW'] timeout_seconds = 300 def vars_for_template(self): return { 'answer_range': list(range(-5, 6, 1)), #'answer_range': self.session.config['answer_range'] # 'first_order_only': self.session.config['panama_lab_experiment'], 'prize': 15, 'current_task': self.participant.vars['page_num'] } def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] self.participant.vars['second_order_ability_w'] = self.player.second_order_ability_w def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['SecondOrderAbilityW'] class SecondOrderAbilityM(Page): form_model = 'player' form_fields = ['second_order_ability_m','current_task','time_SecondOrderAbilityM'] timeout_seconds = 300 def vars_for_template(self): return { 'answer_range': list(list(range(-5, 6, 1))), #'answer_range': self.session.config['answer_range'] # 'first_order_only': self.session.config['panama_lab_experiment'], 'prize': 15, 'current_task': self.participant.vars['page_num'] } def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] self.participant.vars['second_order_ability_m'] = self.player.second_order_ability_m def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['SecondOrderAbilityM'] # class SecondOrderPrefW(Page): # form_model = 'player' # form_fields = ['second_order_preferences_w','current_task'] # timeout_seconds = 300 # def vars_for_template(self): # return { # 'answer_range': list(range(-5, 6, 1)), # #'answer_range': self.session.config['answer_range'] # # 'first_order_only': self.session.config['panama_lab_experiment'], # 'prize': 15, # } # def before_next_page(self): # self.participant.vars['second_order_preferences_w'] = self.player.second_order_preferences_w class Instructions_Slider_Second(Page): form_model = 'player' form_fields = ['current_task','time_Instructions_Slider_Second'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['Instructions_Slider_Second'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } # class SecondOrderPrefM(Page): # form_model = 'player' # form_fields = ['second_order_preferences_m','current_task'] # timeout_seconds = 300 # def vars_for_template(self): # return { # 'answer_range': list(range(-5, 6, 1)), # #'answer_range': self.session.config['answer_range'] # # 'first_order_only': self.session.config['panama_lab_experiment'], # 'prize': 15, # } # def before_next_page(self): # self.participant.vars['second_order_preferences_m'] = self.player.second_order_preferences_w # class Instructions_Cognitive(Page): # def before_next_page(self): # import time # # user has 20 minutes to complete as many pages as possible # self.participant.vars['expiry'] = time.time() + 20*60 # form_model = 'player' # form_fields = ['current_task'] # class Ravens1(Page): # form_model = 'player' # form_fields = ['raven1','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 # class Ravens2(Page): # form_model = 'player' # form_fields = ['raven2','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 # class Ravens3(Page): # form_model = 'player' # form_fields = ['raven3','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 # class Ravens4(Page): # form_model = 'player' # form_fields = ['raven4','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 # class Ravens5(Page): # form_model = 'player' # form_fields = ['raven5','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 # class Ravens6(Page): # form_model = 'player' # form_fields = ['raven6','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 # class Ravens7(Page): # form_model = 'player' # form_fields = ['raven7','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 # class Ravens8(Page): # form_model = 'player' # form_fields = ['raven8','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 # class Ravens9(Page): # form_model = 'player' # form_fields = ['raven9','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 # class Ravens10(Page): # form_model = 'player' # form_fields = ['raven10','current_task'] # timer_text = '' # def get_timeout_seconds(self): # import time # return self.participant.vars['expiry'] - time.time() # def is_displayed(self): # import time # return self.participant.vars['expiry'] - time.time() > 3 class Instructions_Betting(Page): form_model = 'player' form_fields = ['current_task','time_Instructions_Betting'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['Instructions_Betting'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } class Betting(Page): form_model = 'player' form_fields = ['current_task','time_Betting','rand_chosen_name','rand_two_names','name_list','bet1','bet2','bet3','bet4','bet5','bet6','bet7','bet8','bet9','bet10','bet11','bet12','bet13','bet14','bet15','bet16','bet17','bet18','bet19','bet20'] timeout_seconds = 300 def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['Betting'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } class Future_Task(Page): form_model = 'player' form_fields = ['current_task','future_task','time_Future_Task'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['Future_Task'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'current_task': self.participant.vars['page_num'] } # class Personality(Page): # form_model = 'player' # form_fields = ['personality1','personality2','personality3','personality4','personality5','personality6','personality7','personality8','personality9','personality10','current_task'] # class Demographics(Page): # form_model = 'player' # form_fields = ['gender','device','indigenous','afrodescendant','highesteduc','highesteduc_mother','highesteduc_father','marital','children','monthlyincome','ravencorrect','payout','rand_num','rand_task','rand_task_int','difference','payout_prob','elapsed_seconds','current_task','provider','phonenumber' # #'liveswith_parents','liveswith_spouse','liveswith_otherfamily','liveswith_friends','liveswith_none' # ] class Demographics_Rev(Page): form_model = 'player' form_fields = ['time_Demographics_Rev','gender','device','indigenous','afrodescendant','highesteduc','highesteduc_mother','highesteduc_father','marital','children','monthlyincome', # 'ravencorrect', 'payout','rand_num','rand_task','rand_task_int','difference','payout_prob','elapsed_seconds','current_task','provider','phonenumber', 'liveswith_parents','liveswith_spouse','liveswith_otherfamily','liveswith_friends','liveswith_none' ] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['Demographics_Rev'] def vars_for_template(self): return { 'start_seconds': self.player.in_round(1).start_seconds, 'first_order_ability': self.player.in_round(self.participant.vars['task_rounds']['FirstOrderAbility']).first_order_ability, 'first_order_preferences': self.player.in_round(self.participant.vars['task_rounds']['FirstOrderPreferences']).first_order_preferences, 'first_order_ability_IT': self.player.in_round(self.participant.vars['task_rounds']['FirstOrderAbilityIT']).first_order_ability_IT, 'second_order_ability_w': self.player.in_round(self.participant.vars['task_rounds']['SecondOrderAbilityW']).second_order_ability_w, 'second_order_ability_m': self.player.in_round(self.participant.vars['task_rounds']['SecondOrderAbilityM']).second_order_ability_m, 'current_task': self.participant.vars['page_num'] } def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] # class Payout(Page): # form_model = 'player' # form_fields = ['current_task'] class Payout_Rev(Page): form_model = 'player' form_fields = ['current_task'] def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['Payout_Rev'] def before_next_page(self): self.participant.vars['page_num'] = 1 + self.participant.vars['page_num'] def vars_for_template(self): return { 'first_order_ability': self.player.in_round(self.participant.vars['task_rounds']['FirstOrderAbility']).first_order_ability, 'first_order_preferences': self.player.in_round(self.participant.vars['task_rounds']['FirstOrderPreferences']).first_order_preferences, 'first_order_ability_IT': self.player.in_round(self.participant.vars['task_rounds']['FirstOrderAbilityIT']).first_order_ability_IT, 'second_order_ability_w': self.player.in_round(self.participant.vars['task_rounds']['SecondOrderAbilityW']).second_order_ability_w, 'second_order_ability_m': self.player.in_round(self.participant.vars['task_rounds']['SecondOrderAbilityM']).second_order_ability_m, 'current_task': self.participant.vars['page_num'] } # class PilotFeedback(Page): # form_model = 'player' # form_fields = ['pilot_device','pilot_connection','pilot_browser','pilot_submitproblem','pilot_otherproblem','pilot_understandable','pilot_easytounderstand','pilot_hardtounderstand','pilot_suggestions','pilot_selfuncomfy','pilot_otherpeopleuncomfy','pilot_otherexperience'] class Done(Page): form_model = 'player' form_fields = ['current_task'] # page_sequence = [Introduction, # WhoDoYouKnow1,WhoDoYouKnow2,WhoDoYouKnow3,WhoDoYouKnow4, # Instructions_Referrals,Referral1,NextActivity,Referral2,NextActivity,Referral3,NextActivity,Referral4, # Instructions_Slider,Example,ExampleTask,ExampleTask2, # Instructions_Slider2,FirstOrderAbility,NextActivity,FirstOrderPreferences, # Instructions_Slider_Second,SecondOrderAbilityW,NextActivity,SecondOrderAbilityM,NextActivity,SecondOrderPrefW,NextActivity,SecondOrderPrefM, # Instructions_Cognitive,Ravens1,Ravens2,Ravens3,Ravens4,Ravens5,Ravens6,Ravens7,Ravens8,Ravens9,Ravens10, # # Personality, # Demographics, # #GetContactInfo, # Payout,PilotFeedback,Done, # ] # FOB=[FirstOrderAbility,FirstOrderPreferences] # random.shuffle(FOB) # SOB=[SecondOrderAbilityW,SecondOrderAbilityM,SecondOrderPrefW,SecondOrderPrefM] # random.shuffle(SOB) # Referrals=[Referral2,Referral3,Referral4] # random.shuffle(Referrals) #page_sequence = [ # Introduction, # WhoDoYouKnow1,WhoDoYouKnow2,WhoDoYouKnow3,WhoDoYouKnow4, # Instructions_Referrals, # Referral1,NextActivity,Referrals[0],NextActivity,Referrals[1],NextActivity,Referrals[2], # Instructions_Slider,Example,ExampleTask,ExampleTask2, # Instructions_Slider2,FOB[0],NextActivity,FOB[1], # Instructions_Slider_Second,SOB[0],NextActivity,SOB[1],NextActivity,SOB[2],NextActivity,SOB[3], # Instructions_Cognitive,Ravens1,Ravens2,Ravens3,Ravens4,Ravens5,Ravens6,Ravens7,Ravens8,Ravens9,Ravens10, # Personality, # Demographics_Rev, # Future_Task # GetContactInfo,Payout,PilotFeedback,Done #Betting # ] page_sequence = [ Introduction, Instructions_Slider,Example,ExampleTask,ExampleTask2, Instructions_Slider2,FirstOrderAbility,FirstOrderPreferences,FirstOrderAbilityIT, Instructions_Slider_Second,SecondOrderAbilityW,SecondOrderAbilityM, Instructions_Betting, Betting, NextActivity, Future_Task, Demographics_Rev, Payout_Rev, ]