from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Introduction(Page): form_model = 'player' class Premiere_partie(Page): form_model = 'group' def is_displayed(self): return self.player.id_in_group == 1 class SendBackWaitPage(WaitPage): pass class SendBack(Page): form_model = 'group' form_fields = ['sent_back_amount'] def is_displayed(self): return self.player.id_in_group == 2 def vars_for_template(self): tripled_amount = self.group.sent_amount * Constants.multiplier return dict( tripled_amount=tripled_amount, prompt='Please an amount from 0 to {}'.format(tripled_amount), ) class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_payoffs() class Results(Page): form_model = 'player' def vars_for_template(self): return dict(tripled_amount=self.group.sent_amount * Constants.multiplier) class MyPage(Page): form_model = 'player' page_sequence = [Introduction, Premiere_partie, SendBackWaitPage, SendBack, ResultsWaitPage, Results, MyPage]