from otree.api import * class C(BaseConstants): NAME_IN_URL = 'session_full' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): pass class MyPage(Page): def is_displayed(player): # Show to blocked participants OR if they failed to get added to session from session_utils import try_add_participant_if_space states = player.session.vars.get('participant_states', {}) participant_state = states.get(player.participant.code, {}) # If they're already marked as blocked, show this page if participant_state.get('status') == 'blocked': return True # If they're not in the session at all, try to add them # If that fails, they should see this page if player.participant.code not in states: can_join = try_add_participant_if_space( player.session, player.participant.code, 'session_full' ) return not can_join # Show page if they CAN'T join return False page_sequence = [MyPage]