from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class ComprehensionPage(Page): form_model = 'player' form_fields = ['test_question_1', 'test_question_2', 'test_question_3', 'test_question_4'] def before_next_page(self): self.player.check_answers() # @staticmethod # def error_message(self, values): # print('values is', values) # if values['test_question_1'] != 1 or values['test_question_2'] != 2 or \ # values['test_question_3'] != 3 or values['test_question_4'] != 4 or values['test_question_5'] != 5 : # return 'Please read the instructions again.' def test_question_1_error_message(self, value): if value != 1: return 'Incorrect Answer. Please read the instructions again.' def test_question_2_error_message(self, value): if value != 2: return 'Incorrect Answer. Please read the instructions again.' def test_question_3_error_message(self, value): if value != 3: return 'Incorrect Answer. Please read the instructions again.' def test_question_4_error_message(self, value): if value != 4: return 'Incorrect Answer. Please read the instructions again.' def app_after_this_page(self, upcoming_apps): print('upcoming_apps normal route', upcoming_apps) if self.player.all_test_passed: return 'public_goods' page_sequence = [ComprehensionPage]