from otree.api import * import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from session_utils import ( try_add_participant_if_space, # Add this import all_participants_committed, update_session_phase, update_participant_state # And this one ) doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'instructions2' PLAYERS_PER_GROUP = 3 NUM_ROUNDS = 1 class Subsession(BaseSubsession): def creating_session(subsession): print(f"FINAL INSTRUCTIONS: Starting creating_session") # Get all players that oTree created all_players = subsession.get_players() print(f"FINAL INSTRUCTIONS: oTree created {len(all_players)} players: {[p.participant.code for p in all_players]}") # Get active participants from custom system states = subsession.session.vars.get('participant_states', {}) active_codes = [code for code, state in states.items() if state['status'] == 'active'] print(f"FINAL INSTRUCTIONS: Active participants: {active_codes}") # Create a single group with all players, regardless of active status # The wait page will handle filtering who actually participates if len(all_players) > 0: subsession.set_group_matrix([all_players]) print(f"FINAL INSTRUCTIONS: Created single group with all {len(all_players)} players") class Group(BaseGroup): pass class Player(BasePlayer): pass # PAGES class Instructions2(Page): @staticmethod def vars_for_template(player: Player): return dict( image = "images/instructions2.png" ) class Instructions2Wait(WaitPage): pass class Results(Page): pass page_sequence = [Instructions2, Instructions2Wait]