from ._builtin import Page, WaitPage from otree.api import Currency as c, currency_range from .models import Constants class Results(Page): timeout_seconds = 0.0001 def before_next_page(self): if self.participant.vars['Random_Paying_Task'] == 1: self.subsession.paying_round = self.participant.vars['Task1_Paying_Round'] self.subsession.tasks_payoff = self.participant.vars['Task1_Payoff'] else: self.subsession.paying_round = self.participant.vars['Task2_Paying_Round'] self.subsession.tasks_payoff = self.participant.vars['Task2_Payoff'] self.subsession.risk_payoff = self.participant.vars['Risk_Payoff'] class PaymentInfo(Page): def vars_for_template(self): return{ 'currencypayoff':self.participant.payoff.to_real_world_currency(self.session), 'totalpayoff':self.participant.payoff_plus_participation_fee(), 'paying_task': self.participant.vars['Random_Paying_Task'], 'paying_round': self.subsession.paying_round, 'tasks_payoff': self.subsession.tasks_payoff.to_real_world_currency(self.session), 'risk_payoff': self.subsession.risk_payoff.to_real_world_currency(self.session), } page_sequence = [Results, PaymentInfo]