from otree.api import * import pandas as pd import random doc = """ Your app description """ # super simple version with only once race class C(BaseConstants): NAME_IN_URL = 'eval_phase4' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # task variables treat = models.StringField() main = models.IntegerField() yesno = models.IntegerField() bear = models.StringField() # admin info consent_choice = models.StringField( label="", choices=["Consent", "Do not consent"], widget=widgets.RadioSelect ) prolific_id = models.StringField(label="What is your Prolific ID?") # PAGES class Consent(Page): pass class Consent2(Page): form_model = "player" form_fields = ['consent_choice'] class EndNowC(Page): @staticmethod def is_displayed(player): return player.consent_choice == 'Do not consent' class ProlificID(Page): form_model = "player" form_fields = ["prolific_id"] def before_next_page(player: Player, timeout_happened): num = player.participant.id_in_session if (num % 2) == 0: player.treat = 'veiled' else: player.treat = 'direct' class InstG(Page): pass class Task1(Page): form_model = 'player' form_fields = ['main', 'bear'] @staticmethod def is_displayed(player): return player.treat == 'veiled' class Task2(Page): form_model = 'player' form_fields = ['main', 'bear', 'yesno'] @staticmethod def is_displayed(player): return player.treat == 'direct' class Results(Page): pass page_sequence = [Consent, Consent2, EndNowC, ProlificID, InstG, Task1, Task2, Results]