from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Quiz(Page): form_model = 'player' form_fields = ['quiz1', 'quiz6_1', 'quiz7_1'] def error_message(self, values): if values['quiz1'] != True: return 'Question 1 Error!' if values['quiz6_1'] != 300: return 'Question 2.(a) Error! If you finish the experiment in rank one to three, you will receive the 25% of the final fund wealth plus additional 50% of the fund wealth exceeding the median final fund wealth: Your final Points = 0.25 * final fund wealth + 0.5 * (final fund wealth - median final fund wealth).' if values['quiz7_1'] != 250: return 'Question 3.(a) Error! If you finish the experiment in rank four to six, you will receive the 25% of the final fund wealth: Your final Points = 0.25 * final fund wealth.' class OverConfidence(Page): form_model = 'player' form_fields = ['OC1', 'OC2_min', 'OC2_max', 'OC3', 'OC4_min', 'OC4_max', 'OC5'] timeout_seconds = 180 def before_next_page(self): self.player.payoff = 0 def error_message(self, values): if values['OC2_min'] > values['OC2_max']: return '‘Lower’ should lower than ‘Upper!’' if values['OC4_min'] > values['OC4_max']: return '‘Lower’ should lower than ‘Upper’!' page_sequence = [Quiz, OverConfidence]