from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class WaitResult(WaitPage): def after_all_players_arrive(self): for player in self.subsession.get_players(): player.set_final_payoff() class Payment(Page): def vars_for_template(self): total_payoff1 = self.participant.vars['total_payoff_trans'] experiment_earnings1 = int(total_payoff1) / Constants.token_per_RMB belief_payoff1 = self.participant.vars['belief_payoff_trans'] crt_payoff1 = self.participant.vars['crt_payoff_trans'] ravens_payoff1 = self.participant.vars['ravens_payoff_trans'] participation_fee1 = int(self.session.config['participation_fee']) # final_payoff1 = experiment_earnings1 + participation_fee1 + crt_payoff1 + ravens_payoff1 + belief_payoff1 return dict( treatment=self.session.vars['treatment'], random1=self.participant.vars['random1_trans'], random2=self.participant.vars['random2_trans'], random1_payoff=self.participant.vars['random1_payoff_trans'], random2_payoff=self.participant.vars['random2_payoff_trans'], total_payoff=total_payoff1, belief_payoff=belief_payoff1, belief_num=self.participant.vars['belief_num_trans'], experiment_earnings=experiment_earnings1, participation_fee=participation_fee1, # final_payoff=final_payoff1, total_answer=self.participant.vars['total_answer_trans'], crt_payoff=crt_payoff1, total_correct=self.participant.vars['total_correct_trans'], ravens_payoff=ravens_payoff1, ) page_sequence = [ WaitResult, Payment, ]