oTree Forum >

Wait pages interfere with each other during grouping

#1 by Mika2022

Hi Chris,

I use wait pages to group participants by arrival when a certain number is reached and some of them are waiting for x-minutes. Like this: 


def group_by_arrival_time_method(subsession, waiting_players):
    print("number of players waiting:", len(waiting_players))


    if len(waiting_players) == 5:
        print("Creating a full sized group!")
        return waiting_players

    waits = ranked_waiting_seconds(waiting_players)  # call ranked_waiting_seconds function

    if len(waits) == 4 and waits[0] > 180:
        print(
            "4 players have been waiting for longer than 3 minutes, "
            "so we settle for a group of 4"
        )
        return waiting_players

    if len(waits) == 3 and waits[0] > 300:
        print(
            "3 players have been waiting for longer than 4 minutes, "
            "so we settle for a group of 3"
        )
        return waiting_players


When they cannot be grouped in a certain amount of time, I set timeout_happened = True and the wait page shows a completion link. 
I have now noticed that this participant will still be counted as "waiting" in the waiting room and is used to be grouped if someone arrives before the tab is closed. 
When that happens, an application error happens, because the timeout seems to be undefined then (see screenshot). 

How can I prevent that from happening? 
And might that be, because I update my grouping wait page only every 10seconds? 

Thanks and best-
Miriam

Write a reply

Set forum username