from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'survey_draft1' players_per_group = None #num_rounds = 1 tasks = ['DG1', 'DG2', 'DG3'] #num_rounds = len(tasks) class Subsession(BaseSubsession): # pass def creating_session(self): if self.round_number == 1: for p in self.get_players(): round_numbers = list(range(1, Constants.num_rounds + 1)) random.shuffle(round_numbers) p.participant.vars['task_rounds'] = dict(zip(Constants.tasks, round_numbers)) class Group(BaseGroup): pass class Player(BasePlayer): date_session_selected= models.CharField(initial="25 April 2020") date_ddl_part1=models.CharField(initial="20 April 2020") cq1_income_gap_X = models.IntegerField(label="(a) How large is the income gap (in points) between you and Person B in case of selection of distribution X") cq1_income_gap_Y = models.IntegerField(label="(b) How large is the income gap (in points) between you and Person B in case of selection of distribution Y") cq1_aggr_income_gap_X = models.IntegerField(label="(c) How large is the aggregate income (in points) of you and Person B for distribution X") cq1_aggr_income_gap_Y = models.IntegerField(label="(d) How large is the aggregate income (in points) of you and Person B for distribution Y") #decision_1 = models.StringField( # choices=[[1, "X"], [2, "Y"]], # doc="""This player's decision""", # widget=widgets.RadioSelect, #) decision_1 = models.StringField(choices=[['X', 'X'], ['Y', 'Y']],doc="""This player's decision""",widget=widgets.RadioSelect) decision_2 = models.StringField(choices=[['X', 'X'], ['Y', 'Y']],doc="""This player's decision""",widget=widgets.RadioSelect) decision_3 = models.StringField(choices=[['X', 'X'], ['Y', 'Y']],doc="""This player's decision""",widget=widgets.RadioSelect) year_birth = models.IntegerField(label="What is your year of birth?", min=1900, max=2020) gender = models.IntegerField(label="Could you indicate what is your gender?", choices=[[1, "Female"], [2, "Male"], [3, "Prefer not to declare"]]) major_econ = models.BooleanField(label="Is your major in Economics or Business?", choices=[[True, "Yes"], [False, "No"]]) major_other = models.LongStringField(label="If not, could you please specify what is your major?", blank=True) CFC1 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Is talkative" ) CFC2 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Tends to find fault with others") CFC3 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Does a thorough job" ) CFC4 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Is depressed, blue") CFC5 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Is original, comes up with new ideas" ) CFC6 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Is reserved") CFC7 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Is helpful and unselfish with others" ) CFC8 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Can be somewhat careless") CFC9 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Is relaxed, handles stress well" ) CFC10 = models.IntegerField(choices=[1,2,3,4,5], widget=widgets.RadioSelectHorizontal(), label="Is curious about many different things ")