#1 by mvogeley
Hi, I have a problem with my treatment & control group. I have a simple real effort task with two Treatment and one control group. I want to provide a progress bar for the two treatment groups and not the control group. However, after long trial and error, i don't find the problem. maybe someone faced the same problem- In my __init__.py I set the creating_session function the following: def creating_session(subsession: Subsession): if subsession.round_number == 1: for player in subsession.get_players(): participant = player.participant participant.treatment = random.choice(['Control Group', 'Treatment1', 'Treatment2']) The progress bar has been implemented in the Start(Page): class Start(Page): form_model = "player" form_fields = ["number_entered"] timeout_seconds = 60 #Für Control- und Treatmentgruppe 1 nicht anzeigen @staticmethod def vars_for_template(player: Player): if player.matrix == "": matrix_size = 5 random_matrix = [[random.randint(0, 1) for _ in range(matrix_size)] for _ in range(matrix_size)] correct_sum = sum(sum(row) for row in random_matrix) player.matrix = json.dumps(random_matrix) # This converts the matrix to a string player.sum_of_numbers = correct_sum #Load the matrix from the player's field matrix_to_display = json.loads(player.matrix) progress_percent = (player.round_number / C.NUM_ROUNDS) * 100 treatment = player.participant.treatment if 'treatment' in player.participant.vars else None return { 'matrix': matrix_to_display, 'progress_percent': progress_percent, 'treatment': treatment, } Start.html: {% if treatment == 'Treatment1' or treatment == 'Treatment2' %} <div id="progress-container"> <div id="progress-bar" style="width: {{ progress_percent }}%;"></div> </div> {% endif %} I hope someone can help Many thanks
#2 by mvogeley
My session config is the following: SESSION_CONFIGS = [ dict( name='control', display_name="Control Group", app_sequence=['count'], num_demo_participants=1, treatment='control', ), dict( name='treatment1', display_name="Treatment 1", app_sequence=['count'], num_demo_participants=1, treatment='treatment1', ), dict( name='treatment2', display_name="Treatment 2", app_sequence=['count'], num_demo_participants=1, treatment='treatment2', ), # ... other session configurations ... ] It still creates the treatments randomly, but i actually want to choose explicitly which treatment to play