from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants ### Testing ### ### App-Pages ### class FirstPageWelcome(Page): form_model = "player" form_fields = [] # timeout timeout_seconds = 1200 def before_next_page(self): if self.timeout_happened: self.participant.vars["timeout"] = 1 #self.player.timeoutProduced = True else: self.participant.vars["timeout"] = 0 class SecondPageExplanation(Page): form_model = "player" form_fields = [] # timeout timeout_seconds = 1200 def before_next_page(self): if self.timeout_happened: self.participant.vars["timeout"] = 1 #self.player.timeoutProduced = True else: pass def is_displayed(self): return self.participant.vars["timeout"] == 0 class ThirdPageConsent(Page): form_model = "player" form_fields = ["consent"] # timeout timeout_seconds = 1200 def before_next_page(self): import time self.participant.vars['ArrivalTime'] = time.time() if self.timeout_happened: self.participant.vars["timeout"] = 1 #self.player.timeoutProduced = True else: pass def is_displayed(self): return self.participant.vars["timeout"] == 0 class EndByConsent(Page): form_model = "player" form_fields = ["consentRefused"] def is_displayed(self): return self.player.consent == False and self.participant.vars["timeout"] == 0 ### Page sequence ### page_sequence = [FirstPageWelcome, ThirdPageConsent, SecondPageExplanation, EndByConsent]