from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants ### Testing ### ### App-Pages ### class RewardPage(Page): form_model = "player" form_fields = ["reward"] def is_displayed(self): return self.participant.vars["timeout"] == 0 class GoodbyePageVPN(Page): form_model = "player" form_fields = [] # timeout #timeout_seconds = 1200 def is_displayed(self): return self.participant.vars["timeout"] == 0 and self.player.reward == 1 def before_next_page(self): self.participant.vars["generatedCode"] = "XXX" self.player.checkIfCodeIsXXX = str(self.participant.vars) if self.timeout_happened: self.participant.vars["timeout"] = 1 #self.player.timeoutProduced = True else: pass class GoodbyePageMoney(Page): form_model = "player" form_fields = [] # timeout #timeout_seconds = 1200 def is_displayed(self): return self.participant.vars["timeout"] == 0 and self.player.reward == 2 def before_next_page(self): self.participant.vars["generatedCode"] = "XXX" self.player.checkIfCodeIsXXX = str(self.participant.vars) if self.timeout_happened: self.participant.vars["timeout"] = 1 #self.player.timeoutProduced = True else: pass class LastPage(Page): form_model = "player" def is_displayed(self): return self.participant.vars["timeout"] == 0 class TimeoutEndPage(Page): form_model = "player" ### Page sequence ### page_sequence = [RewardPage, GoodbyePageVPN, GoodbyePageMoney, LastPage, TimeoutEndPage]