from otree.api import Currency as c, currency_range from . import models from ._builtin import Page, WaitPage from .models import Constants class Introduction(Page): def vars_for_template(self): pdone = round(self.player.participant._index_in_pages / self.player.participant._max_page_index * 100) return { "pdone" : pdone } class Consent(Page): form_model = models.Player form_fields = ['consentGiven'] def vars_for_template(self): pdone = round(self.player.participant._index_in_pages / self.player.participant._max_page_index * 100) return { "pdone" : pdone } def before_next_page(self): self.player.participant.vars["consentGiven"] = self.player.consentGiven class ConsentRejected(Page): def vars_for_template(self): pdone = 100 return { "pdone" : pdone } def is_displayed(self): return not self.player.participant.vars["consentGiven"] page_sequence = [ Introduction, Consent, ConsentRejected ]