oTree Forum >

Group matching, wait page & problems with inactive windows

#1 by Manuel

Hi everyone,

we have programmed a study with three treatments where players are matched into groups of three at the end of the study to calculate and determine the payoffs. 

We are not very experienced with o-tree and face the following problem: When participants links on the wait page turn inactive (visualized with the yellow point) and then active again, then we receive error messages on a irregular basis and the matching is sometimes delayed. Since it is possible that participants will leave the page for a while and come back to it (let's say after checking their e-mails), we are afraid that they will receive this error message. The problem is that we can't see the error message because as soon as we delete OTREE_PRODUCTION from Heroku, the problem seems to disappear. 

Has anyone face this problem before? We'd be very thankful for any suggestions.

Best
Manuel & Robin

Below our code to match the participants into groups of three before the payoff function is executed:

def waiting_too_long(player: Player):
    participant = player.participant

    waiting = time.time() - participant.wait_page_arrival
    return waiting > 10*60

def group_by_arrival_time_method(subsession, waiting_players):

    base_players = [
        p for p in waiting_players if p.participant.treatment == 'base']
    random_players = [
        p for p in waiting_players if p.participant.treatment == 'random']
    extern_players = [
        p for p in waiting_players if p.participant.treatment == 'extern']

    if len(base_players) >= 3:
        # print('about to create a treatment group')
        return [base_players[0], base_players[1], base_players[2]]

    if len(random_players) >= 3:
        # print('about to create a control group')
        return [random_players[0], random_players[1], random_players[2]]

    if len(extern_players) >= 3:
        # print('about to create a control group')
        return [extern_players[0], extern_players[1], extern_players[2]]

    for player in waiting_players:
        if waiting_too_long(player):
            player.is_solo = True
            player.participant.solo_player = True
            player.participant.finished = True
            return [player]

    # print('not enough players yet to create a group')

# Pages
# -----------------------------------------------------------

class GBAT(WaitPage):
    body_text = """
                Please wait and do not leave this page. If you are not matched into a group after 10 minutes, you will leave this page automatically.
                """
    group_by_arrival_time = True
    after_all_players_arrive = set_payoffs

# Page Sequence
# -----------------------------------------------------------

page_sequence = [GBAT]

#2 by Chris_oTree

Turn on Heroku Sentry. Then the errors will be visible in your sentry dashboard.

Write a reply

Set forum username