from otree.api import * doc = """ Trade-off game, Akdeniz & Mathew, 2022, Normative versus prosocial underpinnings of human decision making. """ class Constants(BaseConstants): name_in_url = 'part1task6eff_1' players_per_group = None num_rounds = 1 payoff_a = 250 num_tokens = 500 token_b = 0.2 token_c = 1 sit = 6 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): tog_eff = models.IntegerField( min=0, max=Constants.num_tokens, label='How many tokens do you want to take from Participant C to give to Participant B?', ) ex1 = models.CurrencyField( doc="""Answer to first example""", min=0, max=Constants.num_tokens*Constants.token_c, label="", ) ex2 = models.CurrencyField( doc="""Answer to second example""", min=0, max=Constants.num_tokens*Constants.token_c, label="", ) ex3 = models.CurrencyField( doc="""Answer to second example""", min=0, max=Constants.num_tokens*Constants.token_c, label="", ) # PAGES class Start(Page): pass class Instructions(Page): form_model = 'player' form_fields = ['ex1', 'ex2', 'ex3'] def error_message(self, value): if value["ex1"] != 250: return 'The first question is not answered correctly. Consult the instructions and try again.' elif value["ex2"] != 25: return 'The second question is not answered correctly. Consult the instructions and try again.' elif value["ex3"] != 375: return 'The third question is not answered correctly. Consult the instructions and try again.' class StartTask(Page): pass class Round1(Page): form_model = 'player' form_fields = ['tog_eff'] class Round2(Page): pass class Round3(Page): @staticmethod def app_after_this_page(player, upcoming_apps): print('upcoming_apps is', upcoming_apps) return "part1task7" page_sequence = [Start, Instructions, StartTask, Round1, Round2, Round3]