from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Welcome(Page): pass class Consent(Page): form_model = 'player' form_fields = [ 'read1', 'agree1' ] def vars_for_template(self): self.player.personal_code() def before_next_page(self): self.participant.vars['consent'] = self.player.agree1 self.participant.vars['drop'] = 0 self.participant.vars['n_drp'] = 0 self.participant.vars['time'] = 0 def app_after_this_page(self, upcoming_apps): if self.player.agree1 == 0: self.participant.vars['drop'] = 1 self.participant.vars['n_drp'] = 0 return "return" class Overview(Page): time_exp = 120 timeout_seconds = time_exp def vars_for_template(self): time = self.time_exp return { 'time': time } def before_next_page(self): if self.timeout_happened: self.participant.vars['drop'] = 1 self.participant.vars['n_drp'] = 1 def app_after_this_page(self, upcoming_apps): if self.timeout_happened: return "return" page_sequence = [Welcome, Consent, Overview]