oTree Forum >

Prevent inactive participants from getting compensation for waiting time

#1 by qxiao

I am looking for help on how to prevent inactive participants from getting compensation for their waiting time.

My study groups participants with a group_by_arrival_time_method(). They are also told that if they wait for more than, say, 10 mins, and cannot be grouped (because there are no other people available), their program will be terminated and they will be compensated for their waiting time. According to the documentation, participants who are inactive, e.g., who switch to another tab, will not be grouped, but it appears that the time they spend outside the oTree tab will still be counted towards their waiting time. This means that participants can start waiting, switch away from oTree right away, and do their own stuff for 10 mins, and still manage to get compensation for waiting. This is not desirable.

My current group_by_arrival_time_method() looks like this:

def group_by_arrival_time_method(subsession, waiting_players):
    # Get players who are not timed out
    available_players = [p for p in waiting_players if not p.participant.was_not_grouped]

    # Group participants based on condition assigned
    cond1_players = [p for p in available_players if p.participant.condition == "1"]
    cond2_players = [p for p in available_players if p.participant.condition == "2"]

    if len(cond1_players) >= C.PLAYERS_PER_GROUP:
        return [cond1_players[i] for i in [*range(C.PLAYERS_PER_GROUP)]]
    elif len(cond2_players) >= C.PLAYERS_PER_GROUP:
        return [cond2_players[i] for i in [*range(C.PLAYERS_PER_GROUP)]]
    else:
        for player in waiting_players:
            if time.time() > player.participant.grouping_timeout:
                player.participant.was_not_grouped = True


I wonder if anyone has an idea how to mark out those who stayed active on the oTree tab for 10 mins so that only these people get paid for their waiting time. Sorry if this sounds like a silly question, but your help is much appreciated!

Write a reply

Set forum username