from otree.api import * doc = """ One player decides how to divide a certain amount between themself and the other player. Akdeniz & Mathew, 2022, Normative versus prosocial underpinnings of human decision making. """ class Constants(BaseConstants): name_in_url = 'part1task1_2' players_per_group = None num_rounds = 1 endowment_dictator = 500 endowment_not_dictator = 0 sit = 4 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): dg = models.IntegerField( label='How many points do you want to give to Participant B?', min=0, max=Constants.endowment_dictator, ) ex1 = models.CurrencyField( doc="""Answer to first example""", min=0, max=Constants.endowment_dictator, label="", ) ex2 = models.CurrencyField( doc="""Answer to second example""", min=0, max=Constants.endowment_dictator, label="", ) # PAGES class Start(Page): pass class Instructions(Page): form_model = 'player' form_fields = ['ex1', 'ex2'] def error_message(self, value): if value["ex1"] != 375: return 'The first question is not answered correctly. Consult the instructions and try again.' elif value["ex2"] != 350: return 'The second question is not answered correctly. Consult the instructions and try again.' class StartTask(Page): pass class Round1(Page): form_model = 'player' form_fields = ['dg'] class Round2(Page): @staticmethod def app_after_this_page(player, upcoming_apps): print('upcoming_apps is', upcoming_apps) participant = player.participant if participant.dg3pp_order == 1: return "part1task2j_2" elif participant.dg3pp_order == 2: return "part1task2_2" page_sequence = [Start, Instructions, StartTask, Round1, Round2]