from ._builtin import Page, WaitPage from otree.api import Currency as c, currency_range from .models import Constants class InstructionsPart2andCQ(Page): form_model = 'player' form_fields = ['cq2_n1', 'cq2_n2'] def before_next_page(self): if self.player.cq2_n2 == 1: self.player.cq2_n2_to_show = 'Tutti i round giocati (secondo il tasso conversione: 3 gettoni = 1 Euro)' if self.player.cq2_n2 == 2: self.player.cq2_n2_to_show = 'Solo un round, selezionato casualmente (secondo il tasso conversione: 3 gettoni = 1 Euro)' else: self.player.cq2_n2_to_show = 'Due round, selezionati casualmente (secondo il tasso conversione: 3 gettoni = 1 Euro)' # class InstructionsPart2CQSolutions(Page): form_model = 'player' form_fields = ['re_read_instructions'] def vars_for_template(self): return dict( cq2_n1_ok=self.player.cq2_n1 == self.player.cq2_n1_solution, cq2_n2_ok=self.player.cq2_n2 == self.player.cq2_n2_solution, re_read_instructions=self.player.re_read_instructions ) class InstructionsPart2ReRead(Page): def is_displayed(self): if self.player.re_read_instructions == 1: return True else: return False class InstructionsPart2Recap(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_n2_to_show'] = self.player.cq2_n2_to_show page_sequence = [ InstructionsPart2andCQ, InstructionsPart2CQSolutions, InstructionsPart2ReRead, InstructionsPart2Recap ]