from otree.api import * doc = """ Consent forms, if the participants refuse to take part in, then exit. """ class C(BaseConstants): NAME_IN_URL = 'consent_forms' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): consent_no = models.IntegerField(initial = 0) pass class Group(BaseGroup): pass class Player(BasePlayer): is_agree = models.BooleanField(initial=False) class ConsentForm(Page): form_model = 'player' form_fields = ['is_agree'] @staticmethod def before_next_page(player,timeout_happened): if player.is_agree: player.subsession.consent_no += 1 class RefusePage(Page): @staticmethod def is_displayed(player: Player): return (not player.is_agree) class InstructionsText(Page): pass class InstructionsGraphics(Page): pass page_sequence = [ConsentForm, RefusePage, InstructionsText, InstructionsGraphics]