from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import time class Welcome(Page): form_model = 'player' form_fields = ['control_question'] def vars_for_template(self): self.player.Prolific_ID = self.player.participant.label class ProlificID(Page): form_model = 'player' form_fields = ['Prolific_ID'] class General_Instructions(Page): form_model = 'player' class Description(Page): form_model = 'player' class Questions(Page): form_model = 'player' form_fields = ['question1', 'question2', 'question3', 'question4', 'question5', 'question6', 'question7',] class The_experiment(Page): form_model = 'player' class Examples(Page): form_model = 'player' class Unconditional_Contribution_decision(Page): form_model = 'player' def get_form_fields(self): if self.player.treatment=="equalpro" or self.player.treatment=="unequalpro": return ['contribution1'] else: return ['withdrawal1'] class Conditional_Contribution_decision(Page): form_model = 'player' def get_form_fields(self): if self.player.treatment=="equalpro": return ['con_contribution_0token', 'con_contribution_1token', 'con_contribution_2token', 'con_contribution_3token', 'con_contribution_4token', 'con_contribution_5token', 'con_contribution_6token', 'con_contribution_7token', 'con_contribution_8token', 'con_contribution_9token', 'con_contribution_10token', 'con_contribution_11token', 'con_contribution_12token', 'con_contribution_13token', 'con_contribution_14token', 'con_contribution_15token', 'con_contribution_16token', 'con_contribution_17token', 'con_contribution_18token', 'con_contribution_19token', 'con_contribution_20token'] elif self.player.treatment=="equalmain": return ['con_withdrawal_0token', 'con_withdrawal_1token', 'con_withdrawal_2token', 'con_withdrawal_3token', 'con_withdrawal_4token', 'con_withdrawal_5token', 'con_withdrawal_6token', 'con_withdrawal_7token', 'con_withdrawal_8token', 'con_withdrawal_9token', 'con_withdrawal_10token', 'con_withdrawal_11token', 'con_withdrawal_12token', 'con_withdrawal_13token', 'con_withdrawal_14token', 'con_withdrawal_15token', 'con_withdrawal_16token', 'con_withdrawal_17token', 'con_withdrawal_18token', 'con_withdrawal_19token', 'con_withdrawal_20token'] elif self.player.treatment == "unequalpro": return ['con_contribution_0token_low', 'con_contribution_1token_low', 'con_contribution_2token_low', 'con_contribution_3token_low', 'con_contribution_4token_low', 'con_contribution_5token_low', 'con_contribution_6token_low', 'con_contribution_7token_low', 'con_contribution_8token_low', 'con_contribution_9token_low', 'con_contribution_10token_low', 'con_contribution_0token_high', 'con_contribution_1token_high', 'con_contribution_2token_high', 'con_contribution_3token_high', 'con_contribution_4token_high', 'con_contribution_5token_high', 'con_contribution_6token_high', 'con_contribution_7token_high', 'con_contribution_8token_high', 'con_contribution_9token_high', 'con_contribution_10token_high', 'con_contribution_11token_high', 'con_contribution_12token_high', 'con_contribution_13token_high', 'con_contribution_14token_high', 'con_contribution_15token_high', 'con_contribution_16token_high', 'con_contribution_17token_high', 'con_contribution_18token_high', 'con_contribution_19token_high', 'con_contribution_20token_high', 'con_contribution_21token_high', 'con_contribution_22token_high', 'con_contribution_23token_high', 'con_contribution_24token_high', 'con_contribution_25token_high', 'con_contribution_26token_high', 'con_contribution_27token_high', 'con_contribution_28token_high', 'con_contribution_29token_high', 'con_contribution_30token_high' ] elif self.player.treatment == "unequalmain": return ['con_withdrawal_0token_low', 'con_withdrawal_1token_low', 'con_withdrawal_2token_low', 'con_withdrawal_3token_low', 'con_withdrawal_4token_low', 'con_withdrawal_5token_low', 'con_withdrawal_6token_low', 'con_withdrawal_7token_low', 'con_withdrawal_8token_low', 'con_withdrawal_9token_low', 'con_withdrawal_10token_low', 'con_withdrawal_0token_high', 'con_withdrawal_1token_high', 'con_withdrawal_2token_high', 'con_withdrawal_3token_high', 'con_withdrawal_4token_high', 'con_withdrawal_5token_high', 'con_withdrawal_6token_high', 'con_withdrawal_7token_high', 'con_withdrawal_8token_high', 'con_withdrawal_9token_high', 'con_withdrawal_10token_high', 'con_withdrawal_11token_high', 'con_withdrawal_12token_high', 'con_withdrawal_13token_high', 'con_withdrawal_14token_high', 'con_withdrawal_15token_high', 'con_withdrawal_16token_high', 'con_withdrawal_17token_high', 'con_withdrawal_18token_high', 'con_withdrawal_19token_high', 'con_withdrawal_20token_high', 'con_withdrawal_21token_high', 'con_withdrawal_22token_high', 'con_withdrawal_23token_high', 'con_withdrawal_24token_high', 'con_withdrawal_25token_high', 'con_withdrawal_26token_high', 'con_withdrawal_27token_high', 'con_withdrawal_28token_high', 'con_withdrawal_29token_high', 'con_withdrawal_30token_high' ] class Instructions(Page): form_model = 'player' class Contribution_and_Estimate(Page): form_model = 'player' def get_form_fields(self): if self.player.treatment == "equalpro": return ['contribution2', 'estimate_equal_con'] elif self.player.treatment == "equalmain": return ['withdrawal2', 'estimate_equal_with'] elif self.player.treatment == "unequalpro": return ['contribution2', 'estimate_other_con', 'estimate_others_con'] elif self.player.treatment == "unequalmain": return ['withdrawal2', 'estimate_other_with', 'estimate_others_with'] class Questionnaire1(Page): form_model = 'player' form_fields = ['gender', 'age', 'language', 'max_income', 'trust', 'risk', 'instructions', 'econ_exp',] class Questionnaire2(Page): form_model = 'player' form_fields = ['Q1', 'Q2', 'Q3', ] class Questionnaire3(Page): form_model = 'player' def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_1(Page): form_model = 'player' form_fields = ['Q3_1', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_2(Page): form_model = 'player' form_fields = ['Q3_2', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_3(Page): form_model = 'player' form_fields = ['Q3_3', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_4(Page): form_model = 'player' form_fields = ['Q3_4', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_5(Page): form_model = 'player' form_fields = ['Q3_5', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_6(Page): form_model = 'player' form_fields = ['Q3_6', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_7(Page): form_model = 'player' form_fields = ['Q3_7', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_8(Page): form_model = 'player' form_fields = ['Q3_8', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_9(Page): form_model = 'player' form_fields = ['Q3_9', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire3_10(Page): form_model = 'player' form_fields = ['Q3_10', ] def get_timeout_seconds(self): return self.player.participant.vars['expiry'] - time.time() def is_displayed(self): if self.get_timeout_seconds() > 1: return True else: return False def before_next_page(self): self.participant.vars['expiry'] = time.time() + 30 class Questionnaire4(Page): form_model = 'player' form_fields = ['Q4', 'Q5', 'Q6', 'Q7'] class Thanks(Page): form_model = 'player' page_sequence = [Welcome, ProlificID, General_Instructions, Description, Questions, The_experiment, Examples, Unconditional_Contribution_decision, Conditional_Contribution_decision, Instructions, Contribution_and_Estimate, Questionnaire1, Questionnaire2, Questionnaire3, Questionnaire3_1, Questionnaire3_2, Questionnaire3_3, Questionnaire3_4, Questionnaire3_5, Questionnaire3_6, Questionnaire3_7, Questionnaire3_8, Questionnaire3_9, Questionnaire3_10, Questionnaire4, Thanks]