from ._builtin import Page, WaitPage from otree.api import Currency as c, currency_range from .models import Constants class IntroWait(WaitPage): wait_for_all_groups = True # class IntroInstructions(Page): # pass class IntroInstructionsTask2P1(Page): def vars_for_template(self): subs = self.subsession return dict( task2order_2=subs.task2_order == 2 ) class IntroInstructionsTask2P2(Page): def vars_for_template(self): subs = self.subsession return dict( task2order_2=subs.task2_order == 2 ) class IntroInstructionsCq2(Page): form_model = 'player' form_fields = ['cq2_n1', 'cq2_n2', 'cq2_n3', 'cq2_n4', 'cq2_n5', 'cq2_n6', 'cq2_n7'] def before_next_page(self): self.player.cq2_n1_solution = 4 self.player.cq2_n2_solution = 'Determinata casualmente' self.player.cq2_n3_solution = self.player.delta_limit self.player.cq2_n4_solution = 'Sì' self.player.cq2_n5_solution = self.player.payoff_R + self.player.payoff_R self.player.cq2_n6_solution = self.player.payoff_P + self.player.payoff_P self.player.cq2_n7_solution = "L'altro partecipante" if self.player.cq2_n2 == 1: self.player.cq2_n2_to_show = 'Pre-determinata' else: self.player.cq2_n2_to_show = 'Determinata casualmente' if self.player.cq2_n4 == 1: self.player.cq2_n4_to_show = 'Sì' else: self.player.cq2_n4_to_show = 'No' if self.player.cq2_n7 == 1: self.player.cq2_n7_to_show = 'Io' else: self.player.cq2_n7_to_show = "L'altro partecipante" class IntroInstructionsCq2Solutions(Page): pass class IntroInstructionsTask2Recap(Page): def before_next_page(self): self.participant.vars['cq2_n1'] = self.player.cq2_n1 self.participant.vars['cq2_n2'] = self.player.cq2_n2 self.participant.vars['cq2_n3'] = self.player.cq2_n3 self.participant.vars['cq2_n4'] = self.player.cq2_n4 self.participant.vars['cq2_n5'] = self.player.cq2_n5 self.participant.vars['cq2_n6'] = self.player.cq2_n6 self.participant.vars['cq2_n7'] = self.player.cq2_n7 def vars_for_template(self): subs = self.subsession return dict( task2order_2=subs.task2_order == 2 ) page_sequence = [ IntroWait, # IntroInstructions, IntroInstructionsTask2P1, IntroInstructionsTask2P2, IntroInstructionsCq2, IntroInstructionsCq2Solutions, IntroInstructionsTask2Recap ]