from otree.api import * c = cu doc = '' class C(BaseConstants): NAME_IN_URL = 'Selection' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 INSTRUCTIONS_TEMPLATE = 'Selection/instructions.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): is_high_dimra = models.BooleanField(choices=[[True, ' 7 dimra'], [False, '3 dimra']], initial=False, label='Your choice is', widget=widgets.RadioSelect) prolific_id = models.StringField(default=str(" ")) class PART1Intro(Page): pass class Part1Instruction(Page): pass def creating_session(subsession): import itertools treatment = itertools.cycle([True, True, True, False, True, True, False]) for player in subsession.get_players(): participant = player.participant participant.treatment = next(treatment) # initialize value here participant.is_dropout = False class instructions(Page): @staticmethod def before_next_page(self, timeout_happened): self.prolific_id = self.participant.label pass pass class Selection(Page): form_model = 'player' form_fields = ['is_high_dimra'] @staticmethod def before_next_page(player: Player, timeout_happened): session = player.session group = player.group participant = player.participant participant.is_high_dimra = player.is_high_dimra # initialize participant.history = [] import time participant.wait_page_arrival = time.time() page_sequence = [instructions,PART1Intro,Part1Instruction,Selection]