from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'quizround' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): quiz1 = models.BooleanField( label='One player is able to offer a transfer of points to the other player', choices=[ [True, 'Yes'], [False, 'No'] ] ) quiz2 = models.StringField( label='What‘s the purpose of this transfer?', choices=['to encourage the other player to contribute', 'it has no purpose'], ) quiz3 = models.BooleanField( label='The transfer can be accepted or rejected', ) quiz4 = models.StringField( label='How many points do you earn in total?', choices=['3', '4', '5'] ) quiz5 = models.StringField( label='How many points do you earn in total?', choices=['2', '4', '5'] ) quiz6 = models.StringField( label='How many points do you earn in total?', choices=['1', '3', '6'] ) # PAGES class Introduction(Page): pass class Instructions(Page): pass class Quiz(Page): form_model = 'player' form_fields = ['quiz1', 'quiz2', 'quiz3', 'quiz4', 'quiz5', 'quiz6'] @staticmethod def error_message(player: Player, values): solutions = dict(quiz1=True, quiz2='to encourage the other player to contribute', quiz3=True, quiz4='3', quiz5='2', quiz6='6') if values != solutions: return "One or more answers were incorrect." page_sequence = [Introduction, Instructions, Quiz]