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 = 'questionnaire' players_per_group = 4 num_rounds = 1 class Subsession(BaseSubsession): def creating_session(self): pay_number = random.choice([1, 2]) for player in self.get_players(): player.treatment = self.session.config['treat'] # 0=control,1=open comm player.paying_part = pay_number player.code = player.participant.code if self.session.config['only'] == 1: player.participant.vars["from_1"] = 10 player.participant.vars["from_2"] = 15 if player.id_in_subsession == 1 or player.id_in_subsession == 6 or player.id_in_subsession == 11: player.participant.vars["orsee_gender"] = "female" player.orsee = "female" else: player.participant.vars["orsee_gender"] = "male" player.orsee = "male" class Group(BaseGroup): type = models.StringField() class Player(BasePlayer): treatment = models.IntegerField() orsee = models.StringField() gender = models.IntegerField(choices=[(1, "Male"), (2, "Female"), (3, "Other")], label="Gender:", widget=widgets.RadioSelect) age = models.IntegerField(choices=[(1, "Younger than 18"), (2, "18-20"), (3, "21-23"), (4, "24-26"), (5, "27-29"), (6, "30 or older")], label="Age:") nationality = models.StringField(label="Nationality:") study = models.IntegerField(choices=[(1, "Medicine"), (2, "Engineering"), (3, "Mathematics and computer science"), (4, "Natural science"), (5, "Law"), (6, "Economics and business"), (7, "Social science"), (8, "Humanities")], label="Field of study:") guess_gender1 = models.IntegerField(choices=[(1, "1 male participant and 1 female participant"), (2, "2 male participants"), (3, "2 female participants")], label="What do you think is the gender composition of the other two players with whom you negotiated in iteration 1?", widget=widgets.RadioSelect) guess_gender2 = models.IntegerField(choices=[(1, "1 male participant and 1 female participant"), (2, "2 male participants"), (3, "2 female participants")], label="What do you think is the gender composition of the other two players with whom you negotiated in iteration 2?", widget=widgets.RadioSelect) guess_nationality1 = models.StringField(label="What do you think is the country of birth of the other two players with whom you negotiated in iteration 1?") guess_nationality2 = models.StringField( label="What do you think is the country of birth of the other two players with whom you negotiated in iteration 2?") friends = models.BooleanField(choices=[(True, "Yes"), (False, "No")], widget=widgets.RadioSelect, label="When you heard the voices of other participants, were you able to recognize any friend, classmate, or acquaintance? ") competetiveness = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), (8, ""), (9, ""), (10, ""), (11, "")], label="", widget=widgets.RadioSelectHorizontal) competetition = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), (8, ""), (9, ""), (10, ""), (11, "")], label="", widget=widgets.RadioSelectHorizontal) risk = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), (8, ""), (9, ""), (10, ""), (11, "")], label="", widget=widgets.RadioSelectHorizontal) time = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), (8, ""), (9, ""), (10, ""), (11, "")], label="", widget=widgets.RadioSelectHorizontal) intentions = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), (8, ""), (9, ""), (10, ""), (11, "")], label="", widget=widgets.RadioSelectHorizontal) altruism = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), (8, ""), (9, ""), (10, ""), (11, "")], label="", widget=widgets.RadioSelectHorizontal) bottle = models.IntegerField(choices=[(1, "5 Euro bottle"), (2, "10 Euro bottle"), (3, "15 Euro bottle"), (4, "20 Euro bottle"), (5, "25 Euro bottle"), (6, "30 Euro bottle"), ], label="Which bottle do you give?", widget=widgets.RadioSelect) punish = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), (8, ""), (9, ""), (10, ""), (11, "")], label="", widget=widgets.RadioSelectHorizontal) heard = models.BooleanField(choices=[(True, "Yes"), (False, "No")], widget=widgets.RadioSelect, label="Have you talked to people who have participated in other sessions of this experiment before?") content = models.BooleanField(choices=[(True, "Yes"), (False, "No")], widget=widgets.RadioSelect, label="Have you heard about the content of this experiment before?") aim = models.StringField(label="What do you think is the aim of this experiment?") understand = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""),], label="", widget=widgets.RadioSelectHorizontal) time_pressure = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), ], label="", widget=widgets.RadioSelectHorizontal) enjoy = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), ], label="", widget=widgets.RadioSelectHorizontal) skills = models.IntegerField(choices=[(1, ""), (2, ""), (3, ""), (4, ""), (5, ""), (6, ""), (7, ""), ], label="", widget=widgets.RadioSelectHorizontal) strategy = models.IntegerField() elaborate2 = models.StringField(label="Explain how your strategy changed.") elaborate3 = models.StringField(label="Explain how the others shaped your bargaining strategy.") paying_part = models.IntegerField() total = models.CurrencyField(initial=0) code = models.StringField()