oTree Forum >

Removing participants' choices after being selected in a round

#1 by user6767 (edited )

Hi there,

I am writing an experiment in which participants will choose 5 courses from a list of 30 courses in order to be accepted into one course. Each course has a unique probability of acceptance and payoff.

Given the low probability of acceptance for some courses, there are multiple rounds for a participant to select courses. For example, if a participant chooses courses 1, 2, 3, 4, 5 but is not accepted into any of those courses, then they proceed to the next round and will have the courses 6, 7, 8..., 29, 30. 

Currently a participant's chosen courses are still appearing after the first round. I would like to ask if there is a way for the chosen courses to be removed (or hidden) in subsequent rounds so that they may not be chosen?

I have a feeling that using player.in_previous_rounds may be useful but am not entirely sure how to implement it. For any further information, I've attached the current code within the .zip files.

Many thanks!

#2 by user6767

Hi again,

Since this post, I have been able to create an updated list that takes the remaining choices for a player after they have submitted their choices. For example, in the first round, the player sees choices 1, 2, 3, 4..., 29, 30. If they choose 1, 2, 3, 4, 5, then their updated list becomes 6, 7, 8, 9..., 29, 30. This is defined as:

updated_list = [6, 7, 8, 9..., 29, 30]

The issue is how to put the updated list back into a player's original choice set. Currently, this is defined in the Player class as:

models.IntegerField(choices=C.INDEX, label='Test', initial=0)

where C.INDEX = [1, 2, 3, 4..., 29, 30]

What I need is to put the 'updated_list' into the 'choices' parameter instead of 'C.INDEX'.

However, the issue is that updated_list is defined AFTER the Player class, the choices parameter will not recognise it. I've tried setting the updated_list to the participant level rather than the player, but still cannot solve this.

In general, is there a way to have a player's choices change between rounds based on the choices they make?

Thanks again.

#3 by user6767

It's all good, I've figured it out...

Just need to adapt the code in line with this:

https://otree.readthedocs.io/en/latest/forms.html#field-name-choices

Write a reply

Set forum username