from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants def vars_for_all_templates(self): return { 'list_M3': self.player.participant.vars['list_M3'], 'choice_M3': self.player.participant.vars['choice_M3'], 'asd': sum(self.player.participant.vars['choice_M3']), 'list_M3_choice': self.player.participant.vars['list_M3_choice'], 'a': 1 in self.player.participant.vars['choice_M3'], 'b': 2 in self.player.participant.vars['choice_M3'], 'c': 3 in self.player.participant.vars['choice_M3'], } class survey_Q1(Page): form_model = 'player' form_fields = ['reason1', 'reason2', 'reason3', 'reason4'] def is_displayed(self): return sum(self.player.participant.vars['choice_M3']) < 9 def vars_for_template(self): return { 'money1': self.player.participant.vars['list_M3'][0][0], 'money2': self.player.participant.vars['list_M3'][0][1], 'money3': self.player.participant.vars['list_M3'][0][2], 'money4': self.player.participant.vars['list_M3'][1][0], 'money5': self.player.participant.vars['list_M3'][1][1], 'money6': self.player.participant.vars['list_M3'][1][2], 'money7': self.player.participant.vars['list_M3'][2][0], 'money8': self.player.participant.vars['list_M3'][2][1], 'money9': self.player.participant.vars['list_M3'][2][2], 'choice1': self.player.participant.vars['choice_M3'][0], 'choice2': self.player.participant.vars['choice_M3'][1], 'choice3': self.player.participant.vars['choice_M3'][2], } class survey_Q2(Page): form_model = 'player' form_fields = ['reason5'] def vars_for_template(self): return { 'money1': self.player.participant.vars['list_M3'][0][0], 'money2': self.player.participant.vars['list_M3'][0][1], 'money3': self.player.participant.vars['list_M3'][0][2], } class survey_Q3(Page): form_model = 'player' form_fields = ['reason6','reason7'] class survey_Q4(Page): form_model = 'player' form_fields = ['reason8_1', 'reason8_2','reason8_3','reason8_4'] page_sequence = [survey_Q1, survey_Q2, survey_Q3, survey_Q4]