from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Question(Page): timeout_seconds = 240 form_model = 'player' form_fields = ['Answer'] def before_next_page(self): self.player.prolific_id = self.participant.label def vars_for_template(self): data = { 'treat': Constants.treatment, # 'horizon': self.subsession.horizon, } return data class consent(Page): form_model = 'player' form_fields = ['consent'] class End(Page): form_model = 'player' def vars_for_template(self): self.player.set_fin_payoff() bon=float(self.participant.payoff) bon=bon/400 payment=self.participant.payoff_plus_participation_fee() data = {'p_answ': self.player.Answer, 'c_answ': Constants.correct_answer, 'bonus': round(bon, 2), 'payme' : payment } # 'payment': c(round(self.participant.payoff, 1)), # 'payment2': c(round(self.player.real_cum_score_y, 1)), return data class Redirect(Page): def js_vars(player): return dict( completionlink= player.subsession.session.config['completionlink']) class noconsent(Page): def is_displayed(self): return self.player.consent==0 # class CognitiveReflectionTest(Page): # form_model = 'player' # form_fields = ['crt_bat', 'crt_widget', 'crt_lake'] page_sequence = [consent,noconsent,Question,End,Redirect]