from otree.api import * import math import pandas as pd import itertools import numpy as np class C(BaseConstants): NAME_IN_URL = 'timeout_groups' TIMEOUT_TEMPLATE = 'timeout_groups/templates/timeout.html' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass def creating_session(subsession): pass class Group(BaseGroup): pass class Player(BasePlayer): extended_wait = models.BooleanField(initial=False) # FUNCTIONS # PAGES class TimeoutGroup(Page): @staticmethod def is_displayed(player): return player.participant.timeout_groups is True @staticmethod def live_method(player, data): if data["extend"] == True: player.extended_wait = True return {0:data} @staticmethod def app_after_this_page(player, upcoming_apps): if player.extended_wait: return "cpr_defaults" else: return "finished_experiment" page_sequence = [TimeoutGroup]