import random from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) from otree.forms import forms author = 'Sky Vercauteren' doc = """ The survey section includes a series of questions that provide a chance to earn a few more points, including a gamble and a chance to donate to a charity. The user will then be shown their final earnings, and the program will finish running. """ class Constants(BaseConstants): name_in_url = 'WN_Survey' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): coin_flip = models.IntegerField(initial=-1) def creating_session(self): self.coin_flip = random.randint(0, 1) pass class Group(BaseGroup): pass class Player(BasePlayer): negDist = models.IntegerField(initial=0) workDist = models.IntegerField(initial=0) question1_negotiation_percent = models.StringField(choices=["The top 25%", "The top 50%, but not the top 25%", "The bottom 50%, but not the bottom 25%", "The bottom 25%"], widget=widgets.RadioSelect, label="") question2_work_percent = models.StringField(choices=["The top 25%", "The top 50%, but not the top 25%", "The bottom 50%, but not the bottom 25%", "The bottom 25%"], widget=widgets.RadioSelect, label="") question3_overall_profit = models.StringField(choices=["The female participants", "The male participants", "Neither - they are likely to negotiate the same percent"], widget=widgets.RadioSelect, label="") question4_negotiation_profit = models.StringField(choices=["The male participant", "The female participant", "Neither - they are likely to negotiate the same percent"], widget=widgets.RadioSelect, label="") question5_gamble = models.StringField(choices=["Gamble 1: low outcome: $1.40, high outcome: $1.40", "Gamble 2: low outcome: $1.20, high outcome: $1.80", "Gamble 3: low outcome: $1.00, high outcome: $2.20", "Gamble 4: low outcome: $0.80, high outcome: $2.60", "Gamble 5: low outcome: $0.60, high outcome: $3.00", "Gamble 6: low outcome: $0.10, high outcome: $3.50"], widget=widgets.RadioSelect, label="") question6_donation = models.StringField(choices=["Donate $1.00 (your payoff from this exercise is $0.00)", "Donate $0.75 (your payoff from this exercise is $0.25)", "Donate $0.50 (your payoff from this exercise is $0.50)", "Donate $0.25 (your payoff from this exercise is $0.75)", "Donate $0.00 (your payoff from this exercise is $1.00)"], widget=widgets.RadioSelect, label="") question7_gender_identity = models.StringField(choices=["Male/Man", "Female/Woman", "Trans Male/Trans Man", "Trans Female/Trans Woman", "Genderqueer/Gender non-conforming", "Other"], widget=widgets.RadioSelect, label="") question8_origin = models.StringField(choices=["No, not of Hispanic, Latino, or Spanish origin", "Yes, Mexican, Mexican American, Chicano, Puerto Rican, Cuban, " + "or other Hispanic, Latino, or Spanish origin"], widget=widgets.RadioSelect, label="") question9_race = models.StringField() question10_income = models.StringField(choices=["Less than $10,000", "$10,001 - 20,000", "$20,001 - 30,000", "$30,001 - 50,000", "$50,001 - 70,000", "$70,001 - 90,000", "$90,001 - 110,000", "$110,001 - 130,000", "$130,001 - 160,000", "$160,001 - $200,000", "More than $200,000", "I do not know"], widget=widgets.RadioSelect, label="") question11_age = models.StringField(choices=["18 to 19 years", "20 to 24 years", "25 to 29 years", "30 to 34 years", "35 to 39 years", "40 to 44 years", "45 to 49 years", "50 to 54 years", "55 to 59 years", "60 to 64 years", "65 to 69 years", "70 to 74 years", "75 to 79 years", "80 to 84 years", "85 or over"], widget=widgets.RadioSelect, label="") question12_education = models.StringField(choices=["Less than high school", "High school", "Vocational education", "Professional degree", "Some college", "College degree", "Graduate degree"], widget=widgets.RadioSelect, label="") def live_set_race(self, race): if race != "[": self.question9_race = race return {0: race} pass