from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Choice(Page): form_model = 'player' form_fields = ['penny_side'] def vars_for_template(self): player = self.player return dict(player_in_previous_rounds=player.in_previous_rounds()) class ResultsWaitPage(WaitPage): after_all_players_arrive = 'set_payoffs' class ResultsSummary(Page): form_model = 'player' def is_displayed(self): player = self.player return self.round_number == Constants.num_rounds def vars_for_template(self): player = self.player player_in_all_rounds = player.in_all_rounds() return dict( total_payoff=sum([p.payoff for p in player_in_all_rounds]), paying_round=self.session.vars['paying_round'], player_in_all_rounds=player_in_all_rounds, ) page_sequence = [Choice, ResultsWaitPage, ResultsSummary]