from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class P01_Welcome(Page): def is_displayed(self): return self.round_number == 1 class P02_Intro(Page): def before_next_page(self): self.group.set_roles() self.player.table_sequence() def is_displayed(self): return self.round_number == 1 class P03_T1_Inst1(Page): def is_displayed(self): return self.round_number == 1 class P04_T1_Inst2(Page): def is_displayed(self): return self.round_number == 1 class P05_T1_Inst3(Page): def is_displayed(self): return self.round_number == 1 class P09_T1_Role(Page): def is_displayed(self): return self.round_number == 1 class P10_T1Frame(Page): form_model = 'player' form_fields = ["T1_choice_X1", "T1_choice_X2", "T1_choice_X3", "T1_choice_X4", "T1_choice_X5", "T1_choice_X6", "T1_choice_X7", "T1_choice_X8", "T1_choice_X9", "T1_choice_X10", "T1_choice_X11", "T1_choice_X12", "T1_choice_X13", "T1_choice_X14", "T1_choice_Y1", "T1_choice_Y2", "T1_choice_Y3", "T1_choice_Y4", "T1_choice_Y5", "T1_choice_Y6", "T1_choice_Y7", "T1_choice_Y8", "T1_choice_Y9", "T1_choice_Y10", "T1_choice_Y11", "T1_choice_Y12", "T1_choice_Y13", "T1_choice_Y14"] def is_displayed(self): return self.player.type == '1' and self.round_number == 1 class W02_T1_PayoffWait(WaitPage): def is_displayed(self): return self.round_number == 1 class P11_T2_Intro(Page): def before_next_page(self): self.player.T1_payoff_calc() def is_displayed(self): return self.round_number == 1 class P12_T2_Inst1(Page): def is_displayed(self): return self.round_number == 1 class P13_T2_Inst2(Page): def is_displayed(self): return self.round_number == 1 class P15_T2_Inst3(Page): def is_displayed(self): return self.round_number == 1 class P16_T2_Control(Page): form_model = 'player' form_fields = ["control1_T2", "control2_T2"] def is_displayed(self): return self.round_number == 1 class P17_T2_Role(Page): def is_displayed(self): return self.round_number == 1 class W03_T2_ShuffleWait(WaitPage): wait_for_all_groups = True def after_all_players_arrive(self): self.subsession.group_randomly(fixed_id_in_group=True) def is_displayed(self): return self.round_number >= 2 class W04_T2_GroupWait(WaitPage): def after_all_players_arrive(self): self.group.T2_offer() class P18_T2_T1(Page): form_model = 'player' form_fields = ["buyer_choice"] def vars_for_template(self): product1 = self.group.get_player_by_id(1).T2_product1 product2 = self.group.get_player_by_id(1).T2_product2 payoff1 = self.group.get_player_by_id(1).T2_payoff1 payoff2 = self.group.get_player_by_id(1).T2_payoff2 period = self.round_number return dict( product1=product1, product2=product2, payoff1=payoff1, payoff2=payoff2, period=period ) def is_displayed(self): return self.player.type == "1" class W06_T2_PayoffWait(WaitPage): def after_all_players_arrive(self): self.group.T2_payoff_calc() class P19_T2_Feedback(Page): def vars_for_template(self): buyer_choice = self.group.get_player_by_id(1).buyer_choice buyer = self.group.get_player_by_id(1).T2_payoff TC = self.group.get_player_by_id(2).T2_payoff period = self.round_number return dict( buyer_choice=buyer_choice, buyer=buyer, TC=TC, period=period ) class Z24a_FeedbackWait(WaitPage): pass class P20_T3_Intro(Page): def is_displayed(self): return self.round_number == Constants.num_rounds class P21_T3_Q1(Page): form_model = 'player' form_fields = ['age', 'sex', 'experience', 'studies'] def is_displayed(self): return self.round_number == Constants.num_rounds class P22_T3_Q2(Page): form_model = 'player' form_fields = ['markets1', 'markets2', 'markets3', 'markets4', 'markets5', 'markets6'] def is_displayed(self): return self.round_number == Constants.num_rounds class P23T1_T3_Q3(Page): form_model = 'player' form_fields = ['verstanden', 'quality_check', 'not_harming_member', 'ownpayoff', 'utilitarian'] def is_displayed(self): return self.round_number == Constants.num_rounds and self.player.type == '1' class P23T2_T3_Q3(Page): form_model = 'player' form_fields = ['verstanden', 'quality_check'] def is_displayed(self): return self.round_number == Constants.num_rounds and self.player.type == '2' class P24_T3_Q4(Page): form_model = 'player' form_fields = ['partei', 'pol_selbstein'] def is_displayed(self): return self.player.round_number == Constants.num_rounds class P24b_T3_Q5(Page): form_model = 'player' form_fields = ['allocation1', 'allocation2', 'allocation3', 'allocation4', 'allocation5', 'allocation6'] def is_displayed(self): return self.player.round_number == Constants.num_rounds class W07_T4_ResultsWait(WaitPage): def after_all_players_arrive(self): self.group.set_payoff() def is_displayed(self): return self.round_number == Constants.num_rounds class P25_T4_ResultsT1(Page): def vars_for_template(self): part1_T1 = self.group.get_player_by_id(1).in_round(1).T1_payoff part1_T2 = self.group.get_player_by_id(2).in_round(1).T1_payoff return dict( part1_T1=part1_T1, part1_T2=part1_T2 ) def is_displayed(self): return self.round_number == Constants.num_rounds class P26_T4_StudyResults(Page): def vars_for_template(self): part1_T1 = self.group.get_player_by_id(1).in_round(1).T1_payoff part1_T2 = self.group.get_player_by_id(2).in_round(1).T1_payoff part2_T1 = self.group.get_player_by_id(1).T2_payoff part2_T2 = self.group.get_player_by_id(2).T2_payoff final_payoff = self.player.payoff.to_real_world_currency(self.session) return dict( part1_T1=part1_T1, part1_T2=part1_T2, part2_T1=part2_T1, part2_T2 = part2_T2, final_payoff = final_payoff ) def is_displayed(self): return self.round_number == Constants.num_rounds class P27_T4_Payment(Page): form_model = 'player' form_fields = ['name', 'surname', 'method'] def is_displayed(self): return self.round_number == Constants.num_rounds class P28b_T4_Payment(Page): form_model = 'player' form_fields = ['IBAN'] def is_displayed(self): return self.player.method == "Banküberweisung" and self.round_number == Constants.num_rounds class P28p_T4_Payment(Page): form_model = 'player' form_fields = ['mail'] def is_displayed(self): return self.player.method == "PayPal" and self.round_number == Constants.num_rounds class P29_T4_End(Page): pass def is_displayed(self): return self.round_number == Constants.num_rounds page_sequence = [P01_Welcome, P02_Intro, P03_T1_Inst1, P04_T1_Inst2, P05_T1_Inst3, P09_T1_Role, P10_T1Frame, W02_T1_PayoffWait, P11_T2_Intro, P12_T2_Inst1, P13_T2_Inst2, P15_T2_Inst3, P16_T2_Control, W03_T2_ShuffleWait, W04_T2_GroupWait, P17_T2_Role, P18_T2_T1, W06_T2_PayoffWait, P19_T2_Feedback, P20_T3_Intro, P21_T3_Q1, P22_T3_Q2, P23T1_T3_Q3, P23T2_T3_Q3, P24_T3_Q4, P24b_T3_Q5, W07_T4_ResultsWait, P25_T4_ResultsT1, P26_T4_StudyResults, #P27_T4_Payment, #P28b_T4_Payment, #P28p_T4_Payment, #P29_T4_End ]