from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class SoundCheck(Page): timeout_seconds = 120 def vars_for_template(self): return {'audio_path': 'global/soundcheck.mp3'} class Introduction(Page): timeout_seconds = 120 def vars_for_template(self): return {'audio_path': 'global/introduction.mp3'} class Rules(Page): timeout_seconds = 120 def vars_for_template(self): return {'audio_path': 'global/rules.mp3'} class IdStage1(Page): timeout_seconds = 120 form_model = 'player' form_fields = ['id1'] # def before_next_page(self): # self.participant.vars['id1'] = self.player.user_id # print("ID1", self.participant.vars['id1']) class IdStage2(Page): timeout_seconds = 120 form_model = 'player' form_fields = ['id2'] def before_next_page(self): self.player.check_id12() class IdStage3(Page): timeout_seconds = 120 def is_displayed(self): return self.player.id_match12 == False form_model = 'player' form_fields = ['id3'] class IdStage4(Page): timeout_seconds = 120 def is_displayed(self): return self.player.id_match12 == False form_model = 'player' form_fields = ['id4'] def before_next_page(self): self.player.check_id34() class IdStage5(Page): timeout_seconds = 60 def is_displayed(self): return self.player.id_match34 == False form_model = 'player' form_fields = ['id5'] class IdStage6(Page): timeout_seconds = 60 def is_displayed(self): return self.player.id_match34 == False form_model = 'player' form_fields = ['id6'] class Gender(Page): timeout_seconds = 120 form_model = 'player' form_fields = ['male', 'age', 'department'] def before_next_page(self): if self.player.male == 1: self.player.own_avatar = 'male' elif self.player.male == 0: self.player.own_avatar = 'female' self.participant.vars['own_avatar'] = self.player.own_avatar self.participant.vars['male'] = self.player.male self.participant.vars['department'] = self.player.department page_sequence = [ SoundCheck, Introduction, Rules, IdStage1, IdStage2, IdStage3, IdStage4, Gender, ]