oTree Forum >

assign particular task numbers to participant

#1 by PigiAbi

Hi oTree community,

I am doing a real effort task. There are 20 participants ideally and we will assign different numbers of tasks to each person depending on their previous task. For example, I want to assign Ella 13 tasks and George 8 tasks. 
I tried to create different sessions for each participant and then used the configure session to do so. But it seems painful during the actual experiment. 
Now I want to write something easier or something to be able to give them the desired number of tasks during the actual experiment. 
Does anyone have any suggestions or experiments? Many thanks!

#2 by BonnEconLab

I am not sure I understand the problem. Three interpretations of what you wrote come to my mind:

1. Do you mean that a different number of tasks would result in a different number of rounds?
If so, set NUM_ROUNDS to a sufficiently large number and use app_after_this_page to skip the rounds as necessary. For instance, if you have a player field num_tasks, then use something like

def app_after_this_page(player, upcoming_apps):
    if player.round_number > player.num_tasks:
        return upcoming_apps[0]

2. Do you mean that you would like to be able to set the numbers of tasks on-the-fly via your browser during an ongoing experiment?

3. Do you mean that the number of tasks which a participant has to complete depends on their history? In that case, you could store the number of tasks to be completed as a participant field and assign a value to the field depending on the history. That is, for instance, in the settings.py file, you include


After assigning a value to player.participant.num_tasks in your first app, use something like

def app_after_this_page(player, upcoming_apps):
    if player.round_number > player.participant.num_tasks:
        return upcoming_apps[0]

in the __init__.py file of your second app.

Write a reply

Set forum username