This is my first experience with oTree. So I am not entirely sure if this is normal. I am testing my experiment now and while the payoff is showing in the excel data file, I am unable to see the earning. It's not that much of a problem since we just need to divide the payoff by 10. And I want to show both the points as well as the payoff. The code is mentioned below:
class Results(Page):
@staticmethod
def vars_for_template(player: Player):
# generate a random outcome as "pchoice"
# determine whether they can get payoff == whether a random number from [0,1] can be less than 0.5
pchoice = np.random.random()
if pchoice <= 0.5:
player.get_payoff = 1
else:
player.get_payoff = 0
# determine the payoff
# since get_payoff = 1 or 0, we can multiply directly to get the final payoff
if player.decision == True:
player.payoff += C.payment_assetA*player.get_payoff
if player.decision == False:
player.payoff += C.payment_assetB*player.get_payoff
if player.get_payoff == 0:
player.payoff += C.payment_otherwise
return dict(
earning = format(Decimal(player.payoff) / Decimal(10), '.2f')
)
I am not sure if this is normal.