from otree.api import * import numpy as np doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'language_test' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): filter = models.BooleanField() # PAGES class LanguageTest(Page): form_model = 'player' form_fields = ['filter'] @staticmethod def app_after_this_page(player, upcoming_apps): if player.filter == False: return 'survey' class role(Page): @staticmethod def is_displayed(player): return player.filter == True @staticmethod def before_next_page(player, timeout_happened): participant = player.participant participant.filter = player.filter import time participant.wait_page_arrival = time.time() '''@staticmethod def before_next_page(player, timeout_happened): participant = player.participant participant.filter = player.filter if timeout_happened: participant.filter = "False" @staticmethod def get_timeout_seconds(player): participant = player.participant participant.filter = player.filter if participant.filter == "False": return 1 # instant timeout, 1 second else: return 30''' def creating_session(subsession: Subsession): for player in subsession.get_players(): participant = player.participant participant.filter = True participant.id_in_group = 0 participant.EXCHANGE_RATE = 1 participant.EXCHANGE_RATE_WO_SOCIAL_PREF = 0 participant.EXCHANGE_RATE_BLUE = 6 # change the following parameters before each session participant.W_SOCIAL_PREF = 0 participant.WO_SOCIAL_PREF = 0 participant.ASYMMETRY = 1 page_sequence = [ LanguageTest, role ]