from ._builtin import Page, WaitPage from otree.api import Currency as c, currency_range from .models import Constants class IntroWp(WaitPage): group_by_arrival_time = True def is_displayed(self): return self.subsession.round_number == 1 class CheatIntroduction(Page): def is_displayed(self): return self.participant.vars['cheat_treatment'] == 'have the possibility to cheat' class NoCheatIntroduction(Page): def is_displayed(self): return self.participant.vars['cheat_treatment'] == 'have no possibility to cheat' class Introduction(Page): """Description of the game: How to play and returns expected""" def vars_for_template(self): return { 'player_in_all_rounds': self.player.in_all_rounds(), } class DetermineVoteNumber(Page): form_model = 'player' form_fields = ['die_rolling'] class Election(Page): form_model = 'player' form_fields = ['vote_p1', 'vote_p2', 'vote_p3', 'vote_p4'] class VoteCheck(Page): form_model = 'player' form_fields = ['vote_p1', 'vote_p2', 'vote_p3', 'vote_p4'] def is_displayed(self): return self.player.vote_check == 2 class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_payoffs() class Results(Page): def vars_for_template(self): return { 'player_in_all_rounds': self.player.in_all_rounds(), 'total_vote_p1': self.group.total_vote_p1, 'total_vote_p2': self.group.total_vote_p2, 'total_vote_p3': self.group.total_vote_p3, 'total_vote_p4': self.group.total_vote_p4, } page_sequence = [ IntroWp, CheatIntroduction, NoCheatIntroduction, DetermineVoteNumber, Election, VoteCheck, ResultsWaitPage, Results ]