from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import time class IQ_A_Instructions(Page): form_model = 'player' form_fields = [ 'iqctrl1', 'iqctrl2', 'iqctrl3', ] def error_message(self, value): return self.player.error_message(value) class IQ_B_Ready(Page): def before_next_page(self): # set time limit for task here in seconds (current: 4 minutes) self.participant.vars['expiry'] = time.time() + Constants.time_limit*60 class IQ_C_Task_01(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_1'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_02(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_2'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_03(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_3'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_04(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_4'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_05(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_5'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_06(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_6'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_07(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_7'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_08(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_8'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_09(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_9'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_10(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_10'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_11(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_11'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_12(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_12'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_13(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_13'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_14(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_14'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_15(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_15'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_16(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_16'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_17(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_17'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_18(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_18'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_19(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_19'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_C_Task_20(Page): timer_text = 'Time remaining:' form_model = 'player' form_fields = ['iqtask_20'] def get_timeout_seconds(self): return self.participant.vars['expiry'] - time.time() def is_displayed(self): return self.get_timeout_seconds() > 0 class IQ_D_Payment(Page): def before_next_page(self): self.player.iqscorecalc() class IQ_E_Belief(Page): form_model = 'player' form_fields = ['prior1', 'prior2', 'prior3', 'prior4'] page_sequence = [ IQ_A_Instructions, IQ_B_Ready, IQ_C_Task_01, IQ_C_Task_02, IQ_C_Task_03, IQ_C_Task_04, IQ_C_Task_05, IQ_C_Task_06, IQ_C_Task_07, IQ_C_Task_08, IQ_C_Task_09, IQ_C_Task_10, IQ_C_Task_11, IQ_C_Task_12, IQ_C_Task_13, IQ_C_Task_14, IQ_C_Task_15, IQ_C_Task_16, IQ_C_Task_17, IQ_C_Task_18, IQ_C_Task_19, IQ_C_Task_20, IQ_D_Payment, IQ_E_Belief, ]