from otree.api import * c = cu doc = '' #Class Creation class C(BaseConstants): NAME_IN_URL = 'Outro' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 TOTAL_EARNINGS_WIN = 35 TOTAL_EARNINGS_LOSE = 25 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): #PEQ Questions dif = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) commit = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) enjoy = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) attr_fung = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) attr_hedon = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) attr_novel = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) attr_dist1 = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) dist2 = models.CharField(initial=None, choices=['1', '2', '3', '4', '5', '6', '7'], widget=widgets.RadioSelectHorizontal()) equity1 = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) equity2 = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) motive = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) purch_fun = models.CharField(initial=None, choices=[('1', 'Extremely'), ('2', 'Very'), ('3', 'Somewhat'), ('4', 'Not Very'), ('5', 'Not at all')], widget=widgets.RadioSelectHorizontal()) purch_enjoy = models.CharField(initial=None, choices=[('1', 'Extremely'), ('2', 'Very'), ('3', 'Somewhat'), ('4', 'Not Very'), ('5', 'Not at all')], widget=widgets.RadioSelectHorizontal()) purch_pleas = models.CharField(initial=None, choices=[('1', 'Extremely'), ('2', 'Very'), ('3', 'Somewhat'), ('4', 'Not Very'), ('5', 'Not at all')], widget=widgets.RadioSelectHorizontal()) purch_useful = models.CharField(initial=None, choices=[('1', 'Extremely'), ('2', 'Very'), ('3', 'Somewhat'), ('4', 'Not Very'), ('5', 'Not at all')], widget=widgets.RadioSelectHorizontal()) purch_pract = models.CharField(initial=None, choices=[('1', 'Extremely'), ('2', 'Very'), ('3', 'Somewhat'), ('4', 'Not Very'), ('5', 'Not at all')], widget=widgets.RadioSelectHorizontal()) purch_funct = models.CharField(initial=None, choices=[('1', 'Extremely'), ('2', 'Very'), ('3', 'Somewhat'), ('4', 'Not Very'), ('5', 'Not at all')], widget=widgets.RadioSelectHorizontal()) well_being = models.CharField(initial=None, choices=[('1', 'Completely'), ('2', 'Very well'), ('3', 'Somewhat'), ('4', 'Very little'), ('5', 'Not at all')], widget=widgets.RadioSelectHorizontal()) competitive = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) risk_pref = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) cash_alt_pref = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) noncash_alt_pref = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) movie_pref = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) coffee_pref = models.CharField(initial=None, choices=[('1', '1 '), ('2', '2 '), ('3', '3 '), ('4', '4 '), ('5', '5 '), ('6', '6 '), ('7', '7 ')], widget=widgets.RadioSelectHorizontal()) #demographics gender = models.CharField(initial=None, choices=[['Male', 'Male'], ['Female', 'Female'], ['Nonbinary', 'Nonbinary'], ['Other', 'Other'], ['Prefer not to answer', 'Prefer not to answer']], label='As which gender do you identify?', widget=widgets.RadioSelect) age = models.IntegerField(label='What is your age, in years?') accounting = models.BooleanField(initial=False, blank=True, widget=widgets.CheckboxInput()) finance = models.BooleanField(initial=False, blank=True, widget=widgets.CheckboxInput()) economics = models.BooleanField(initial=False, blank=True, widget=widgets.CheckboxInput()) management = models.BooleanField(initial=False, blank=True, widget=widgets.CheckboxInput()) marketing = models.BooleanField(initial=False, blank=True, widget=widgets.CheckboxInput()) business_other = models.BooleanField(initial=False, blank=True, widget=widgets.CheckboxInput()) non_business = models.BooleanField(initial=False, blank=True, widget=widgets.CheckboxInput()) class_standing = models.CharField(initial=None, choices=[['Freshman', 'Freshman'], ['Sophomore', 'Sophomore'], ['Junior', 'Junior'], ['Senior (4th year)', 'Senior (4th year)'], ['Senior (5+ years)', 'Senior (5+ years)'], ['Graduate', 'Graduate']], label='What is your class standing?', widget=widgets.RadioSelect) job = models.CharField(initial=None, choices=[['Yes', 'Yes'], ['No', 'No']], label='Do you have a full or part time job?', widget=widgets.RadioSelect) hours_worked = models.CharField(initial=None, choices=[['40+ hours', '40+ hours'], ['30-40 hours', '30-40 hours'], ['20-30 hours', '20-30 hours'], ['10-20 hours', '10-20 hours'], ['0-10 hours', '0-10 hours'], ['Not applicable', 'Not applicable']], label='How many hours per week do you work at your full or part time job?', widget=widgets.RadioSelect) #Function Building def creating_session(subsession: Subsession): config = subsession.session.config session = subsession.session session.bonus_win = C.TOTAL_EARNINGS_WIN - config['participation_fee'] session.bonus_lose = C.TOTAL_EARNINGS_LOSE - config['participation_fee'] #Pages class Payoff(Page): pass class PEQInstructions(Page): pass class PEQ1(Page): form_model = 'player' @staticmethod def get_form_fields(player: Player): return ['dif', 'commit', 'enjoy', 'attr_fung', 'attr_hedon', 'attr_novel', 'attr_dist1', 'dist2'] class PEQ2(Page): form_model = 'player' @staticmethod def get_form_fields(player: Player): return ['equity1', 'equity2', 'motive', 'purch_fun', 'purch_enjoy', 'purch_pleas', 'purch_useful', 'purch_pract', 'purch_funct', 'well_being', 'competitive', 'risk_pref'] class PEQ3(Page): form_model = 'player' @staticmethod def get_form_fields(player: Player): if player.session.config['cash_payment']: return ['cash_alt_pref', 'movie_pref', 'coffee_pref'] else: return ['noncash_alt_pref', 'movie_pref', 'coffee_pref'] class PEQ4(Page): form_model = 'player' @staticmethod def get_form_fields(player: Player): return ['gender', 'age', 'class_standing', 'job', 'hours_worked', 'accounting', 'finance', 'economics', 'marketing', 'management', 'business_other', 'non_business'] page_sequence = [ PEQInstructions, PEQ1, PEQ2, PEQ3, PEQ4, Payoff ]