from otree.api import * c = cu doc = '\nThis is a survey/experiment about decision making. You can earn a possible bonus payment depending on a decision and have to answer a few questions afterwards.' class C(BaseConstants): NAME_IN_URL = 'Digital_Economics_Research2' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 PAYOFF_A = cu(2.17) PAYOFF_B = cu(1.63) PAYOFF_C = cu(1.09) PAYOFF_D = cu(0.54) INSTRUCTIONS_TEMPLATE = 'Digital_Economics_Research2/instructions.html' class Subsession(BaseSubsession): pass def creating_session(subsession: Subsession): session = subsession.session import itertools treatments = itertools.cycle([0,1,2,1,2]) for player in subsession.get_players(): player.treatments = next(treatments) class Group(BaseGroup): pass class Player(BasePlayer): cooperate = models.BooleanField(choices=[[True, 'A'], [False, 'B']], doc='This player s decision', widget=widgets.RadioSelect) age = models.IntegerField(label='What is your age?') gender = models.StringField(choices=[['female', 'female'], ['male', 'male'], ['diverse', 'diverse']], label='What is your gender?') country = models.StringField(label='What is your country of residence?') religion = models.StringField(choices=[['Yes', 'Yes'], ['No', 'No']], label='Do you describe yourself as religious?') higher_instance = models.StringField(choices=[['Yes', 'Yes'], ['No', 'No']], label='Have you ever had an experience which convinced you of the extistence of God/Gods/comparable higher instances?') education = models.StringField(choices=[['Early childhood education (e.g. nursery)', 'Early childhood education (e.g. nursery)'], ['Primary education (e.g. elementary school)', 'Primary education (e.g. elementary school)'], ['School-leaving qualifications (e.g. high school, college, A-levels...)', 'School-leaving qualifications (e.g. high school, college, A-levels...)'], ['Bachelor or Master level education', 'Bachelor or Master level education'], ['Higher academic education ', 'Higher academic education ']], label='What is your level of education?') comprehension1 = models.StringField(choices=[['You pick A', 'You pick A'], ['You pick B', 'You pick B']], label='Which earns you more money:') comprehension2 = models.StringField(choices=[['You pick A', 'You pick A'], ['You pick B', 'You pick B']], label='Which earns the other person more money:') comprehension3 = models.StringField(choices=[['Other person picks A', 'Other person picks A'], ['Other person picks B', 'Other person picks B']], label='Which earns you more money:') comprehension4 = models.StringField(choices=[['Other person picks A', 'Other person picks A'], ['Other Person picks B', 'Other person picks B']], label='Which earns the other person more money:') comprehension5 = models.CurrencyField(label='If you pick B and the other person picks A, what bonus will you receive?') treatments = models.IntegerField() attention_check = models.StringField(choices=[['Shopping', 'Shopping'], ['Religion', 'Religion'], ['Books', 'Books'], ['Fish', 'Fish'], ['Cars', 'Cars'], ['Other', 'Other']], label='Based on the text you read, what would you say is the general topic of the text?') attention_check_1 = models.IntegerField(label='What is the result of 2+3?') class Introduction(Page): form_model = 'player' class Priming(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return not player.treatments ==0 class Decision(Page): form_model = 'player' form_fields = ['cooperate'] class Comprehension(Page): form_model = 'player' @staticmethod def get_form_fields(player: Player): if player.treatments == 0: return ['comprehension1', 'comprehension2', 'comprehension3', 'comprehension4', 'comprehension5'] else: return ['comprehension1', 'comprehension2', 'comprehension3', 'comprehension4', 'comprehension5', 'attention_check'] class Demographic_questions(Page): form_model = 'player' form_fields = ['age', 'gender', 'country', 'attention_check_1', 'religion', 'higher_instance', 'education'] class LastPage(Page): form_model = 'player' page_sequence = [Introduction, Priming, Decision, Comprehension, Demographic_questions, LastPage]