from .models import * class IntroductionPage(Page): form_model = 'player' def is_displayed(self): player = self.player session = self.subsession return session.round_number % (Constants.num_rounds/2) == 1 # class IntroductionNextPage(Page): # form_model = 'player' # def is_displayed(self): # session = self.subsession # return False class Shuffler(WaitPage): wait_for_all_groups = True after_all_players_arrive = 'shuffle' class SignalsPage(Page): form_model = 'player' def vars_for_template(self): player = self.player participant = self.participant session = self.subsession return dict(num_treatment_rounds = int(Constants.num_rounds / Constants.num_treatments)) class VotingExpertPage(Page): form_model = 'player' form_fields = ['vote'] def is_displayed(self): player = self.player return player.expert def before_next_page(self): timeout_happened = self.timeout_happened # I may have to move this group = self.group player = self.player #player.action = player.vote #group.expert_vote = player.vote def vars_for_template(self): player = self.player participant = self.participant session = self.subsession return dict(num_treatment_rounds = int(Constants.num_rounds / Constants.num_treatments)) class VotingPage(Page): form_model = 'player' form_fields = ['action'] def is_displayed(self): player = self.player return not player.expert def vars_for_template(self): player = self.player participant = self.participant session = self.subsession return dict(num_treatment_rounds = int(Constants.num_rounds / Constants.num_treatments)) class VotingWaitPage(WaitPage): wait_for_all_groups = True after_all_players_arrive = 'get_winner_subsession' template_name = 'Session3a/VotingWaitPage.html' def vars_for_template(self): player = self.player participant = self.participant session = self.subsession return dict(num_treatment_rounds = int(Constants.num_rounds / Constants.num_treatments)) class ResultsPage(Page): form_model = 'player' def before_next_page(self): player = self.player participant = self.participant player.winnings = participant.payoff_plus_participation_fee() def vars_for_template(self): player = self.player session = self.subsession class ResultsWaitPage(WaitPage): wait_for_all_groups = True template_name = 'Session3a/ResultsWaitPage.html' # form_model = 'player' def before_next_page(self): player = self.player participant = self.participant player.winnings = participant.payoff_plus_participation_fee() def vars_for_template(self): player = self.player session = self.subsession int(Constants.num_rounds / Constants.num_treatments) class EndTreatmentPage(Page): form_model = 'player' def is_displayed(self): session = self.subsession return session.round_number == Constants.num_rounds/2 class PayoffPage(Page): form_model = 'player' def is_displayed(self): session = self.subsession return session.round_number == Constants.num_rounds def vars_for_template(self): player = self.player participant = self.participant session = self.subsession return dict(total_earned = participant.payoff_plus_participation_fee(), sum_of_payoffs = participant.payoff, sum_of_payoffs_dollars = participant.payoff.to_real_world_currency(self.session), participation_fee = participant.payoff_plus_participation_fee() - participant.payoff.to_real_world_currency(self.session)) page_sequence = [Shuffler, IntroductionPage, SignalsPage, VotingExpertPage, VotingPage, VotingWaitPage, ResultsPage, ResultsWaitPage, EndTreatmentPage, PayoffPage]