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 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.IntegerField( label='What is your age (in years)?', min=13, max=99) gender = models.StringField( choices=['Female', 'Male', 'Other', 'I prefer not to answer'], label='What is your gender?', widget=widgets.RadioSelectHorizontal) nationality = models.StringField( label='What is your nationality?') studies = models.BooleanField( choices= [[True,'Yes'], [False, 'No']], label='Are you a student?', widget=widgets.RadioSelectHorizontal) study_field = models.StringField( label='If you are a student, what is your field of studies? If not please answer No.', blank=True) employed = models.StringField( choices= ['Full-time employee', 'Part-time employee', 'Casual employee', 'Student', 'Retired', 'Unemployed'], label='What is your current employment status?', ) academic_degree = models.StringField( label='What is your highest academic degree? (Example: Bachelor of Science)', blank=True) num_children = models.IntegerField( blank =True, label='How many children do you have?', min=0, max=15) income = models.IntegerField( label='What is your average monthly net income (in $) (i.e. your income after taxes) ?', min=0, max=90000, blank=True) future_income = models.IntegerField( label='If you are a student, what do you think will be your monthly net income in your first job after graduation (in €)? ?', min=0, max=1000000, blank=True) parents_income = models.StringField( choices=['Lower third', 'Middle third', 'Upper third'], label='When you were a child, what was your parents’ income in comparison to others?', widget=widgets.RadioSelect, blank=True) patience = models.StringField( choices=['0 - not at all', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10 - very much'], label='How willing are you to give up something that is beneficial for you today in order to benefit more from that in the future?', widget=widgets.RadioSelect) risk = models.StringField( choices=['0 - not at all', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10 - very much'], label='In general, how willing are you to take risks??', widget=widgets.RadioSelect) trust1 = models.StringField( choices=['0 - strongly disagree ', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10 - totally agree'], label='How much do you agree with the following statement: "I assume that people have only the best intentions."', widget=widgets.RadioSelect) trust2 = models.StringField( choices=['0 - not at all', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10 - very much'], label='How much do you trust the organizer of this study that you receive your promised payments?', widget=widgets.RadioSelect) health = models.StringField( choices=["0 - very bad", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10 - very good"], label="In your opinion, how is your health condition?", widget=widgets.RadioSelect, blank=True) alcohol = models.IntegerField( blank =True, min=0, max=7, label='How many days per week do you consume alcoholic beverages?', ) smoke = models.BooleanField( choices=[[True, 'Yes'], [False, 'No']], label='Do you smoke?', widget=widgets.RadioSelectHorizontal) exercise = models.IntegerField( blank =True, min=0, max=7, label='How many days per week do you do exercise?', ) severe_loss = models.BooleanField( choices=[[True, 'Yes'], [False, 'No']], blank=True, label='Have you experienced the loss of a close family member or friend?', widget=widgets.RadioSelectHorizontal) safety = models.StringField( choices=["0 - very unsafe", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10 - very safe"], label="How would you rate the level of safety in your neighborhood on a scale from 1 to 10?", widget=widgets.RadioSelect) holidays = models.IntegerField( label='How many months in advance do you usually book your summer holidays?', min=0, max=99) insurance1 = models.BooleanField( choices=[[True, 'Yes'], [False, 'No']], label='Do you usually buy a cancellation insurance when you buy train/flight tickets?', widget=widgets.RadioSelectHorizontal) insurance2 = models.BooleanField( choices=[[True, 'Yes'], [False, 'No']], label='Do you usually buy an add-on insurance when you e.g. a new computer or a new camera?', widget=widgets.RadioSelectHorizontal) future1 = models.StringField( choices=["0 - very uncertain", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10 - very certain"], label="How certain are you about how your life will be in 1 year?", widget=widgets.RadioSelect) future2 = models.StringField( choices=["0 - very uncertain", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10 - very certain"], label="How certain are you about how your life will be in 5 years?", widget=widgets.RadioSelect) future3 = models.StringField( choices=["0 - very uncertain", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10 - very certain"], label="How certain are you about how your life will be in 10 years?", widget=widgets.RadioSelect) crt_concert = models.IntegerField( label=''' A concert ticket and a drink cost $44 in total. The ticket costs $40 more than the drink. How many $ does the drink cost?''' ) crt_computer = models.IntegerField( label=''' If it takes 7 persons 7 hours to repair 7 computers, how many hours would it take 100 persons to repair 100 computers? ''' ) crt_bacteria = models.IntegerField( label=''' A scientist observes the growth of bacteria. Every hour, the bacteria doubles in size. If it takes 24 hours for the bacteria to cover the entire area under the microscope, how many hours would it take the bacteria to cover half area?''' ) prob_choir = models.IntegerField( label=''' Out of 1,000 inhabitants in a small town, 500 are members of a choir. Of these 500 choir members, 100 are men. Of the 500 inhabitants who are not members of the choir, 300 are men. What is the probability (in %) that a randomly selected man is a choir member? Please indicate the probability as a number between 0 and 100.''' )