from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Survey1(Page): form_model = 'player' form_fields = ['q_education_US', 'q_browser'] class Survey2(Page): form_model = 'player' form_fields = ['q_finance_involved', 'q_finance_decisions', 'q_same_experiment'] class Survey3(Page): form_model = 'player' form_fields = ['q_risk_preference', 'q_math', 'q_optimism', 'q_confidence', 'q_recognize_errors', 'q_competitive', 'q_enjoy_winning', 'q_regret'] class Survey4(Page): form_model = 'player' form_fields = ['q_understand', 'q_understand_parts', 'q_comment'] class Survey5(Page): form_model = 'player' def get_form_fields(self): if self.player.participant.vars['treatment'] == 'treatment': return ['q_beliefs', 'q_exact', 'q_puzzle_to_estimate', 'q_trust', 'q_choice', 'q_trick', 'q_process'] else: return ['q_beliefs', 'q_exact', 'q_puzzle_to_estimate', 'q_trust', 'q_lucky', 'q_process'] class End(Page): form_model = 'player' form_fields = ['prolific_id'] def before_next_page(self): self.player.participant_vars = str(self.player.participant.vars) self.player.session_vars = str(self.player.session.vars) self.player.set_payoffs() class Results(Page): def vars_for_template(self): return { 'bonus_portfolio': c(self.player.bonus_portfolio), 'bonus_elicit': c(self.player.bonus_elicit), 'bonus_total': self.participant.payoff, 'payoff_total': self.participant.payoff_plus_participation_fee() } page_sequence = [ Survey1, Survey2, Survey3, Survey4, Survey5, End, Results ]