from ._builtin import Page, WaitPage from otree.api import Currency as c, currency_range from .models import Constants class Introduction(Page): """Description of the game: How to play and returns expected""" #print("intro", round_number) pass class Contribute(Page): """Player: Choose how much to contribute""" form_model = 'player' form_fields = ['contribution'] #print("contribute", round_number) class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_payoffs() body_text = "Attendi il contributo dell’altro partecipante..." class Results(Page): """Players payoff: How much each has earned""" def vars_for_template(self): cumul = sum([p.payoff for p in self.player.in_all_rounds()]) self.player.cumulative_payoff = cumul print(self.round_number) return { 'total_earnings': self.group.total_contribution * Constants.multiplier, } page_sequence = [ Introduction, Contribute, ResultsWaitPage, Results ]