from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'instructions2_principals_nounder' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 SEPARATE_POT = cu(1.75) BELIEFPAYOFF = cu(2.5) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): Puzzles1 = models.IntegerField( choices=[1, 2, 3, 4, 5, 6, 7, 8], blank=True, initial = 0, label='' ) Puzzles2 = models.IntegerField( choices=[1, 2, 3, 4, 5, 6, 7, 8], blank=True, initial=0, label='' ) Puzzles3 = models.IntegerField( choices=[1, 2, 3, 4, 5, 6, 7, 8], blank=True, initial=0, label='' ) c_question1 = models.IntegerField( choices=[[1, 'perform additions'], [2, 'solve puzzles'], [3, 'recite poetry'], [4, 'transcribe Greek letters']], label='You will __________ in each round.', widget=widgets.RadioSelect, ) c_question2 = models.IntegerField( choices=[[1, 'be more likely to get a high Task payment'], [2, 'be sure to get a high Task payment'], [3, "not be affected by the Performer's performance"]], label='If your Performer have more correct answers in a round, you will...', widget=widgets.RadioSelect, ) c_question3 = models.IntegerField( choices=[[1, '$2'], [2, '$1'], [3, '$1.5'], [4, '$1.75']], label='Suppose your Task payment is $2. What is the most you can pay to your Performer?', widget=widgets.RadioSelect, ) c_question4 = models.IntegerField( choices=[[1, 'You will get the $0.25'], [2, 'Another random Performer will get the $0.25'], [3, 'The researchers will get the $0.25']], label='Suppose you assign your paired Performer $1 and a random Performer from this study $0.5, where will the ' ' rest of the money ($0.25) go?', widget=widgets.RadioSelect, ) c_question5 = models.IntegerField( choices=[[1, 'the Task payment (either a high or low payment)'], [2, 'the Belief payment (either $2.5 or $0)'], [3, 'the Task payment (either a high or low payment) OR the Belief payment (either $2.5 or $0)']], label='How much bonus payment will you get in a round?', widget=widgets.RadioSelect, ) # PAGES class Instructions_task1(Page): @staticmethod def vars_for_template(player: Player): return dict( separate_pot=C.SEPARATE_POT, ) class Paymentrule(Page): @staticmethod def vars_for_template(player: Player): return dict( separate_pot=C.SEPARATE_POT, belief_payoff=C.BELIEFPAYOFF, ) class Instructions_beliefs(Page): @staticmethod def vars_for_template(player: Player): return dict( belief_payoff=C.BELIEFPAYOFF, ) class Instructions_task1_decider(Page): pass class SomeUnderstandingQuestions(Page): form_model = 'player' form_fields= ['c_question1', 'c_question2', 'c_question3', 'c_question4', 'c_question5'] @staticmethod def error_message(player, values): print('values is', values) if values["c_question1"] != 2 or values["c_question2"] != 1 or values["c_question3"] != 4 or values["c_question4"] != 3 or values["c_question5"] != 3: return 'There is at least one incorrect answer. Please, reconsider.' class Instructions_example_task(Page): form_model='player' form_fields=['Puzzles1', 'Puzzles2', 'Puzzles3'] timeout_seconds = 5 #this time needs to be changed to 60 seconds page_sequence = [Instructions_task1, Instructions_task1_decider, Instructions_example_task, Instructions_beliefs, Paymentrule, ]