#1 by fantinexiao
Hello,
I am conducting an experiment with multiple apps, in one early app, I asked participant to make choices over two lotteries (e.g. between lottery P and Q), and I ask them to make this choice again in the later app. Specifically, I would like to show them their intial choice, and allow them to change their decision.
Ideally, I want to define a new variable in the later app, and set the initial value to their previous choices, which I stored in a participant value, and then they can freely change it. However, I have problem referring initial values to a participant variable in the player field.
So this is the code of how I stored the participant varialbe in the early app:
class Lottery_trans(Page):
form_model = "player"
form_fields = ['trans_pq']
def before_next_page(player, timeout_happened):
participant = player.participant
participant.trans_pq = player.trans_pq
and in the later session, I defined an updated variable in a different app:
class Player(BasePlayer):
trans_pq_up = models.IntegerField(
choices=[
[0, "Give me this left prospect from the envelope"],
[1, "Give me this right prospect from the envelope"],
],
widget=widgets.RadioSelect
initial = vars(player.participant.trans_pq)
)
but otree informs AttributeError: module 'otree.models.player' has no attribute 'participant'. Could you please tell me how to solve this problem? Thanks a lot!
Best,
Fantine