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!

#2 by prerana

Hi qxiao,

Were you able to figure out a solution for this?

#3 by qxiao

hi, unfortunately not yet. would love to hear if anyone has a solution to it!

for now I just include warnings for participants that if they switch away they will not be able to continue. it works for most.

#4 by Daniel_Frey

Hello

If I'm not mistaken, you could do something with the list waiting_players, since the inactive players will be automatically removed from that list.

For example, you could save the IDs of the players who were in waiting_players, were inactive (and therefore not in waiting_players anymore) and returned (and therefore reappeared in waiting_players) in a session-variable and display a different page for those players after the WaitPage.

Hope that helps!

Best,
Daniel

#5 by qxiao

Hi Daniel, thanks for the solution! It looks promising. will report back once I get a chance to try it out.

Write a reply

Set forum username