Consider a game with 3 rounds. In every round the player makes a choice (stored in the variable choice
).
Now, in the 3rd round I want to call someFunction
and thereby access the choice made in the 2nd round.
Unfortunately someFunction
returns None
. I do not understand why. If I place the function call in a template file, everything works out fine.
Help would be appriciated - I ve been searching for hours.
class Subsession(BaseSubsession):
def before_session_starts(self):
if self.round_number == 3:
for player in self.get_players():
player.participant.vars['someKey'] = player.someFunction()
class Player(BasePlayer):
choice = models.CharField(initial=None,
choices=['A','B','C'],
widget=widgets.RadioSelect())
def someFunction(self):
return self.in_round(2).choice
Why is this happening?