from . import models from ._builtin import Page, WaitPage from otree.api import Currency as c, currency_range from .models import Constants class Introduction(Page): pass class Decide(Page): form_model = 'player' form_fields = ['units'] timeout_seconds = 240 def error_message(self, values): if values['units']> self.player.maximal_capacity: return 'Это больше, чем Ваши мощности могут произвести :(' def vars_for_template(self): p = self.player return { 'your_maximal_capacity': p.maximal_capacity, 'your_marginal_cost': p.marginal_cost, } def before_next_page(self): if self.timeout_happened: self.player.units = 0 class ResultsWaitPage(WaitPage): body_text = "Подождем других..." def after_all_players_arrive(self): self.group.set_payoffs() class Results(Page): pass class Survey(Page): form_model = 'player' form_fields = ['name', 'phone_number', 'email'] def is_displayed(self): return self.subsession.round_number==1 page_sequence = [ Introduction, Survey, Decide, ResultsWaitPage, Results ]