oTree Forum >

Set timeout_seconds to be different for first round?

#1 by Lstott

Hello I am trying to figure out the best way to set the timeout_seconds so first round is longer than the remaining rounds.
Also running the program it will execute both if blocks if I subsession.round_number == 2 when I generate a new game.
What is the best way to handle this? 
Ty, Luke

# def creating_session(subsession: Subsession):
#     if subsession.round_number == 1:
#         print("ROUND ONE")
#         Contribute.timeout_seconds = 60

#2 by Chris_oTree

get_timeout_seconds

#3 by Lstott

I was looking through the get_timeout_seconds examples and should I just nest it in the page since I am doing the before_next_page also or call the method within it?

Could just use the before_next_page and set it inside there? 



@staticmethod
def get_timeout_seconds(player):
    participant = player.participant
    import time
    return participant.expiry - time.time()
    
@staticmethod
def before_next_page(player, timeout_happened):
    if timeout_happened:
        player.touched_input = True

Write a reply

Set forum username