from otree.api import * doc = """ Choice matching experiment, September 2022 """ class C(BaseConstants): NAME_IN_URL = 'CM_consent' # Introduction page adapted to the treatment PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 TREATMENT = 1 freq_bonus = 4 class Subsession(BaseSubsession): pass def creating_session(subsession): if subsession.round_number == 1: for player in subsession.get_players(): participant = player.participant participant.treatment_p = subsession.session.config['TREATMENT'] # participant.treatment_p = C.TREATMENT class Group(BaseGroup): pass class Player(BasePlayer): prolific_ID = models.StringField(label="Prolific ID") accept = models.IntegerField(choices=[[1, "Si"], [0, "No"]], widget=widgets.RadioSelect) ################################# PAGES ######################################################## class Information_sheet(Page): pass class Consent(Page): form_model = 'player' form_fields = ['accept'] class Prolific_ID(Page): def is_displayed(player: Player): return player.accept == 1 form_model = 'player' form_fields = ['prolific_ID'] class End_page(Page): def is_displayed(player: Player): return player.accept == 0 page_sequence = [ Information_sheet, Consent, Prolific_ID, End_page ]