from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class PG_Intro(Page): form_model = 'player' def is_displayed(self): return self.round_number == 1 return True class PG_Quiz(Page): form_model = 'player' form_fields = ['Q1groupmembers', 'Q2nosingroup', 'Q3periods', 'Q4pointsgiven', 'Q5carryover'] def is_displayed(self): return self.round_number == 1 return True class PB_Intro(Page): form_model = 'player' def is_displayed(self): return self.round_number == Constants.part1_rounds + 1 return True class PB_Quiz(Page): form_model = 'player' form_fields = ['Q6newgroup', 'Q7addperiods', 'Q8beta', 'Q9indcon', 'Q10groupcon'] def is_displayed(self): return self.round_number == Constants.part1_rounds + 1 return True class PG_Decision(Page): form_model = 'player' form_fields = ['contribution'] def is_displayed(self): return self.round_number <= Constants.part1_rounds return True class PB_Decision(Page): form_model = 'player' form_fields = ['contribution'] def is_displayed(self): return self.round_number >= Constants.part1_rounds + 1 return True class ResultsWaitPage(WaitPage): body_text = 'Waiting for other participants to contribute.' def is_displayed(self): return True def after_all_players_arrive(self): self.group.set_payoffs() class PG_Results(Page): form_model = 'player' def is_displayed(self): return True def vars_for_template(self): return dict(others_contribution=self.group.total_contribution - self.player.contribution) page_sequence = [PG_Intro, PG_Quiz, PB_Intro, PB_Quiz, PG_Decision, PB_Decision, ResultsWaitPage, PG_Results]