from otree.api import * import numpy as np doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'consent' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 TIME = 7 PROLIFIC_RATE = 6 FIXED_MONEY = np.round(PROLIFIC_RATE/60 * TIME,2) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): def make_field(label): return models.IntegerField( blank= False, label = label, widget = widgets.RadioSelectHorizontal, choices= [ [1, 'Yes'], [0, 'No'] ] ) c1 = make_field('I confirm that I read and understood the study information.') c2 = make_field('I know that participation in this experiment is voluntary and that I can withdraw at any time.') c3 = make_field('I confirm that I am at least 18 years old and I want to participate in this experiment.') prolificId = models.StringField(label= "What is your Prolific ID?") # FUNCTIONS # PAGES class Consent(Page): form_model = 'player' form_fields = ['c1','c2','c3'] class noConsent(Page): @staticmethod def is_displayed(player: Player): return (player.c1 == 0 or player.c2 == 0 or player.c3 == 0) class prolificId(Page): form_model = 'player' form_fields = ['prolificId'] @staticmethod def is_displayed(player: Player): return (player.c1 == 1 and player.c2 == 1 and player.c3 == 1) page_sequence = [Consent, noConsent, prolificId]