from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Practice_Round(Page): def is_displayed(self): return self.round_number<=3 class Round(Page): def is_displayed(self): return self.round_number>=4 class Firm_Effort(Page): """This page is only for Firm to decide on Effort """ form_model = 'group' form_fields = ['firm_effort'] def is_displayed(self): return self.player.id_in_group == 1 class Student_Effort(Page): """This page is only for Student to decide on Effort """ form_model = 'group' form_fields = ['student_effort'] def is_displayed(self): return self.player.id_in_group == 2 class Wait(WaitPage): pass class Firm_Price(Page): """This page is only for Firm to decide on Effort """ form_model = 'group' form_fields = ['firm_price'] def is_displayed(self): return self.player.id_in_group == 1 class Student_Buy(Page): """This page is only for Firm to decide on Effort """ form_model = 'group' form_fields = ['student_buy'] def is_displayed(self): return self.player.id_in_group == 2 class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_payoffs() body_text = "Waiting for result." class Results(Page): pass class Survey(Page): form_model = 'player' form_fields = ['share','r1','r2','r3','r4','r5','r6','r7','r8','r9','r10','age','gender','major','gpa','ethnicity'] def is_displayed(self): return self.round_number ==Constants.num_rounds class ShuffleWaitPage(WaitPage): wait_for_all_groups = True def after_all_players_arrive(self): self.subsession.do_my_shuffle() class ResultsWaitPage2(WaitPage): def after_all_players_arrive(self): for p in self.group.get_players(): p.set_payoff() body_text = "Waiting for payment result." class Payment(Page): def is_displayed(self): return self.round_number ==Constants.num_rounds page_sequence = [ Practice_Round, Round, Firm_Effort, Student_Effort, Wait, Firm_Price, Wait, Student_Buy, ResultsWaitPage, Results, ShuffleWaitPage, Survey, ResultsWaitPage2, Payment ]