from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random class Constants(BaseConstants): name_in_url = 'survey' players_per_group = None num_rounds = 1 treatment_lf = 'lf' treatment_hf = 'hf' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass AGREE_CHOICES = ( (1, 'Strongly disagree'), (2, 'Disagree'), (3, 'Neither agree nor disagree'), (4, 'Agree'), (5, 'Strongly agree') ) def make_field(label): return models.IntegerField( choices=AGREE_CHOICES, label=label, widget=widgets.RadioSelectHorizontal, ) def make_check_box(label): return models.BooleanField( label=label, widget=widgets.CheckboxInput, blank=True ) class Player(BasePlayer): #Demograoghics page age = models.IntegerField( label='What is your age?', min=13, max=125) gender = models.IntegerField( choices=[(1,'Male'), (2,'Female'), (3,'Other'), (4,'Prefer not to say')], label='What is your gender?', widget=widgets.RadioSelect) education = models.IntegerField( choices=[(1,"No formal education"), (2,"Primary education"), (3,"Secondary education"), (4,"GED") ,(5,"Vocational qualification"), (6,"Bachelor's degree"), (7,"Master's degree"), (8,"Doctorate or higher")], label='What is the highest level of education attained?', widget=widgets.RadioSelect) work_experience = models.IntegerField( label='How many years of work experience do you have?', min=0, max=125) risk = models.IntegerField( choices=[(0,"0 (NOT at all willing to take risks)"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10 (VERY willing to take risks)")], label='How do you see yourself: are you generally a person who is fully prepared to take RISKS or do you try to avoid taking RISKS? Please choose an option on the scale from 0 (NOT at all willing to take risks) to 10 (VERY willing to take risks).', widget=widgets.RadioSelectHorizontal) trust = models.IntegerField( choices=[(0,"1 (very UNWILLING to trust)"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10 (very WILLING to trust)")], label='On a scale of 1-10, please rate how willing you are to TRUST other people. 1 indicates that you are very UNWILLING and 10 indicates that you are very WILLING.', widget=widgets.RadioSelectHorizontal) why_effort = models.LongStringField ( label='How did you decide how many winning balls to buy?', blank=True) why_confront = models.LongStringField ( label='Please explain why you confronted the supervisor/did not confront the supervisor?', blank=True) #supervisor open ended why_bonus = models.LongStringField ( label='Please explain how you decided how much bonus to award?', blank=True) #Instructions clear instructions_clear = make_field('Please indicate how much you agree with the statement: "The instructions of the experiment were clear to me". An honest answer to this question will help us improve the instructions for future sessions and will not affect your payoff in any way.') why_unclear = models.LongStringField ( label='(Optional question) Please explain which (if any) decision in the experiment was confusing. You can also use this field for any comments/suggestions for the researchers.', blank=True) #manipulation check # m = models.PositiveIntegerField( # verbose_name="The reports presented to the supervisor when they made their bonus decision every period contained:", # choices=[(1, 'Both the company profit level AND how many winning balls the employee bought'), (2, 'Only the company profit level (HIGH or LOW)'), (3, ' Only how many winning balls the employee bought')], # widget=widgets.RadioSelect, #) m_survey= models.PositiveIntegerField( verbose_name="Finally, we would like to know to what extent you paid attention while answering the questions in this questionnaire. Note that the answer to this question WILL NOT affect your payoff for this experiment. Please indicate whether you agree with the following statement: The researchers can rely on my answers in this questionnaire.", choices=[(1, 'Yes'), (2, 'In between'), (3, 'No')], widget=widgets.RadioSelect, ) #employee 1 #text Think back to when you were deciding how many winning balls to buy. Which of the following factors influenced this decision (you can select multiple factors): e_we_bonus = make_check_box("I bought a high number of balls because I expected the supervisor to give me a higher bonus if I did so") e_we_fair = make_check_box("I bought a number of balls which I considered fair") e_we_trust = make_check_box("I bought a high number of balls because the supervisor trusted me") e_we_unfair = make_check_box("I bought a low number of balls because I received an unfair bonus in a previous period") e_we_other = make_check_box("Other") e_we_text = models.StringField ( label='Please explain what other factor influenced you.', blank=True) #Think back to when you were deciding whether to confront the supervisor. If you did not confront the supervisor please indicate what would have determined you to confront them. Which of the following factors influenced this decision (you can select multiple factors): e_wc_unfair = make_check_box("Because I received an unfair bonus") e_wc_not_share = make_check_box("Because the supervisor did not share the benefits with me when profit was HIGH") e_wc_strategic = make_check_box("Because it would make the supervisor assign me higher bonuses in future periods") e_wc_other = make_check_box("Other") e_wc_text = models.StringField ( label='Please explain what other factor influenced you.', blank=True) #employee 2 #risk #trust #manipulation check e_luck = make_field("Luck played a big part in how much bonus I got.") e_fair = make_field("The bonuses I received were fair.") e_punnish_confront = make_field("If I thought the bonus was too low, I confronted the supervisor.") e_punnish_effort = make_field("If I thought the bonus was too low, I reduced how many winning balls I bought in the following periods.") e_assymetric_high = make_field("I think it was fair to receive a higher bonus when profit was HIGH regardless of how many winning balls I bought.") e_assymetric_low = make_field("I think it was fair to receive a lower bonus when profit was LOW regardless of how many winning balls I bought.") fair_allocation = models.PositiveIntegerField( choices=[(1,"How many winning balls were bought"),(2,"Whether the company profit was HIGH or LOW"), (3,"A combination of the two")], widget=widgets.RadioSelect, label="In my opinion, a FAIR bonus was based on:" ) # e_bc_effort = make_check_box("How many winning balls I bought") # e_bc_outcome = make_check_box("Whether the company profit was HIGH or LOW") # e_bc_confrontation = make_check_box("Whether I confronted the supervisor") # e_bc_other = make_check_box("Other") # e_bc_text = models.StringField ( # label='Please explain what other factor influenced you.', # blank=True) e_bi_effort=models.IntegerField( min=0, max=100, blank=True ) e_bi_outcome=models.IntegerField( min=0, max=100, blank=True ) e_bi_other=models.IntegerField( min=0, max=100, blank=True ) e_bi_text = models.StringField ( label='Please explain what other factor influenced the bonus.', blank=True) trust_reciprocity = make_field("When someone puts their trust in me, I don't like letting them down.") s_bi_effort=models.IntegerField( min=0, max=100, blank=True ) s_bi_outcome=models.IntegerField( min=0, max=100, blank=True ) s_bi_other=models.IntegerField( min=0, max=100, blank=True ) s_bi_text = models.StringField ( label='Please explain what other factor influenced the bonus.', blank=True) s_wb_effort = make_check_box("To motivate the employee to buy many balls") s_wb_confront = make_check_box("To convince the employee not to confront me") s_wb_fair_own = make_check_box("To give a bonus which I considered fair") s_wb_fair_employee = make_check_box("To give a bonus which the employee would consider fair") s_wb_other = make_check_box("Other") s_wb_text = models.StringField ( label='Please explain what other factor influenced you.', blank=True) s_fair = make_field("The bonuses I awarded were fair.") s_assymetric_low = make_field("The employee thought it was fair to receive a lower bonus when profit was LOW regardless of how many winning balls they bought.") assymetric_low = models.IntegerField( choices=[(0,"Only on how many winning balls they bought"),(1,"Mostly on how many winning balls they bought and partially on whether the company profit was HIGH or LOW"),(2,"Equal weight to how many winning balls they bought and to whether the company profit was HIGH or LOW"), (3,"Mostly on whether the company profit was HIGH or LOW and partially on how many winning balls they bought"), (4,"Only on whether the company profit was HIGH or LOW")], label=' Imagine a period in which an employee bought 5 winning balls and profit was LOW. That employee would find it FAIR to be rewarded based on:', widget=widgets.RadioSelect) assymetric_high = models.IntegerField( choices=[(0,"Only on how many winning balls they bought"),(1,"Mostly on how many winning balls they bought and partially on whether the company profit was HIGH or LOW"),(2,"Equal weight to how many winning balls they bought and to whether the company profit was HIGH or LOW"), (3,"Mostly on whether the company profit was HIGH or LOW and partially on how many winning balls they bought"), (4,"Only on whether the company profit was HIGH or LOW")], label=' Imagine a period in which an employee bought 1 winning ball and profit was HIGH. That employee would find it FAIR to be rewarded based on:', widget=widgets.RadioSelect) s_motivation_allocation = models.PositiveIntegerField( choices=[(1,"How many winning balls the employee bought"),(2,"Whether the company profit was HIGH or LOW"), (3,"A combination of the two")], widget=widgets.RadioSelect, label="I think the best way to make the employee buy as many winning balls as possible was to reward them based on:" ) s_confrontation_allocation = models.PositiveIntegerField( choices=[(1,"How many winning balls the employee bought"),(2,"Whether the company profit was HIGH or LOW"), (3,"A combination of the two")], widget=widgets.RadioSelect, label="I think the best way to make the employee not confront me was to reward them based on:" ) ia_e_1 = models.BooleanField( widget=widgets.RadioSelect, choices=[(0,"Option A"),(1,"Option B")]) ia_e_2 = models.BooleanField( widget=widgets.RadioSelect, choices=[(0,"Option A"),(1,"Option B")]) ia_e_3 = models.BooleanField( widget=widgets.RadioSelect, choices=[(0,"Option A"),(1,"Option B")]) ia_g_1 = models.BooleanField( widget=widgets.RadioSelect, choices=[(0,"Option A"),(1,"Option B")]) ia_g_2 = models.BooleanField( widget=widgets.RadioSelect, choices=[(0,"Option A"),(1,"Option B")]) ia_g_3 = models.BooleanField( widget=widgets.RadioSelect, choices=[(0,"Option A"),(1,"Option B")]) def get_role(self): if 'role' in self.session.config: return self.session.config['role'] else: return self.participant.vars['role'] #def get_treatment(self): # return self.player.participant.vars['role']