from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Intro(Page): pass class IA_E(Page): form_model = 'player' form_fields = ['ia_e_1','ia_e_2','ia_e_3'] class IA_G(Page): form_model = 'player' form_fields = ['ia_g_1','ia_g_2','ia_g_3'] class open_ended(Page): form_model = 'player' def get_form_fields(self): if self.player.get_role()=="Supervisor": return ['why_bonus']#'instructions_clear','why_unclear'] else: return ['why_effort', 'why_confront']#,'instructions_clear','why_unclear'] class Demographics(Page): form_model = 'player' form_fields = ['age', 'work_experience','gender', 'education', 'm_survey' ] class Employee_1(Page): def is_displayed(self): return self.player.get_role()=="Employee" form_model = 'player' form_fields = ['e_we_bonus','e_we_fair', 'e_we_trust', 'e_we_unfair','e_we_other', 'e_we_text', 'e_wc_unfair','e_wc_not_share','e_wc_strategic', 'e_wc_other', 'e_wc_text','e_bi_effort','e_bi_outcome','e_bi_other','e_bi_text'] def error_message(self, values): if values['e_we_bonus']==False and values['e_we_fair']==False and values['e_we_trust']==False and values['e_we_unfair']==False and values['e_we_other']==False: return 'Please select one factor that influenced your in deciding how many winning balls to buy. If none of the factors displayed influenced you, please select Other and briefly describe how you decided.' if values['e_we_other']==True and not values['e_we_text']: return 'Briefly describe the other factor that influenced you in deciding how many winning balls to buy' if values['e_wc_unfair']==False and values['e_wc_not_share']==False and values['e_wc_other']==False and values['e_wc_strategic']==False: return 'Please select one factor that influenced your in deciding whether to confront the supervisor. If none of the factors displayed influenced you, please select Other and briefly describe how you decided.' if values['e_wc_other']==True and not values['e_wc_text']: return 'Briefly describe the other factor that influenced you in deciding to confront the supervisor' if int(values['e_bi_effort'] or 0)+int(values['e_bi_outcome'] or 0)+int(values['e_bi_other']or 0)!=100: return 'Please make sure that you distributed a total of 100 for the last question. Right now the total is '+str(int(values['e_bi_effort'] or 0)+int(values['e_bi_outcome'] or 0)+int(values['e_bi_other']or 0)) if int(values['e_bi_other'] or 0)>0 and not values['e_bi_text']: return 'Briefly describe the other factor that influenced your bonus for the last question' class Employee_2(Page): def is_displayed(self): return self.player.get_role()=="Employee" form_model = 'player' form_fields = ['risk','trust','fair_allocation'] class Employee_3(Page): def is_displayed(self): return self.player.get_role()=="Employee" form_model = 'player' form_fields = ['trust_reciprocity','e_luck', 'e_fair','e_punnish_confront', 'e_punnish_effort','assymetric_high' ,'assymetric_low' ] class Supervisor_1(Page): def is_displayed(self): return self.player.get_role()=="Supervisor" form_model = 'player' form_fields = ['s_wb_effort','s_wb_confront', 's_wb_fair_own', 's_wb_fair_employee', 's_wb_other', 's_wb_text', 's_bi_effort','s_bi_outcome','s_bi_other','s_bi_text'] def error_message(self, values): if values['s_wb_effort']==False and values['s_wb_confront']==False and values['s_wb_fair_own']==False and values['s_wb_fair_employee']==False and values['s_wb_other']==False: return 'Please select one factor that influenced your in deciding how many bonus points to award. If none of the factors displayed influenced you, please select Other and briefly describe how you decided.' if values['s_wb_other']==True and not values['s_wb_text']: return 'Briefly describe the other factor that influenced you in deciding how many bonus points to award' if int(values['s_bi_effort'] or 0)+int(values['s_bi_outcome'] or 0)+int(values['s_bi_other']or 0)!=100: return 'Please make sure that you distributed a total of 100 for the last question. Right now the total is '+str(int(values['s_bi_effort'] or 0)+int(values['s_bi_outcome'] or 0)+int(values['s_bi_other']or 0)) if int(values['s_bi_other'] or 0)>0 and not values['s_bi_text']: return 'Briefly describe the other factor that influenced your bonus for the last question' class Supervisor_2(Page): def is_displayed(self): return self.player.get_role()=="Supervisor" form_model = 'player' form_fields = ['risk','trust','fair_allocation'] class Supervisor_3(Page): def is_displayed(self): return self.player.get_role()=="Supervisor" form_model = 'player' form_fields = ['trust_reciprocity','s_fair', 's_motivation_allocation','s_confrontation_allocation','assymetric_high', 'assymetric_low'] page_sequence = [ Intro, open_ended, Employee_1, Employee_2, Employee_3, Supervisor_1, Supervisor_2, Supervisor_3, Demographics, IA_E, IA_G, ]