from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Consent(Page): form_model = 'player' form_fields = ['Consent'] class End_no_consent(Page): form_model = 'player' def is_displayed(self): return self.player.Consent == "No" class Survey1(Page): form_model = 'player' form_fields = ['A1', 'Extroversion1', 'A2R', 'A3', 'Agreeableness1R', 'A4'] class Survey2(Page): form_model = 'player' form_fields = ['A5', 'Conscientiousness1', 'A6', 'A7', 'Neuroticism1', 'A8'] class Survey3(Page): form_model = 'player' form_fields = ['A9', 'Openness1', 'A10', 'A11', 'Extroversion2R', 'A12R'] class Survey4(Page): form_model = 'player' form_fields = ['A13R', 'Agreeableness2', 'A14', 'A15', 'Conscientiousness2R', 'A16R'] class Survey5(Page): form_model = 'player' form_fields = ['A17', 'Neuroticism2R', 'A18', 'A19R', 'Openness2R', 'A20'] class Instructions1(Page): form_model = 'player' form_fields = ['quiz_1'] def error_message(self, values): if values['quiz_1'] != 1: return 'Everyone in the group chose to contribute 0 tokens to the Group Account. Hence, your payoff from the Group Account is 0 ECU. You kept all 8 tokens in your Private Account, hence, your payoff from the Private Account is 90 ECU. Therefore, your earnings for this task are 90 + 0 = 90 ECU.' class Instructions2(Page): form_model = 'player' form_fields = ['quiz_2'] def error_message(self, values): if values['quiz_2'] != 2: return 'Everyone in the group chose to contribute 6 tokens to the Group Account. Hence, the total amount of tokens in the Group Account is 6 x 4 = 24. So your payoff from the Group Account is 120 ECU. You kept 2 tokens in your Private Account, hence, your payoff from the Private Account is 50 ECU. Therefore, your earnings for this task are 50 + 120 = 170 ECU.' class Instructions3(Page): form_model = 'player' form_fields = ['quiz_3'] def error_message(self, values): if values['quiz_3'] != 3: return 'You contributed 6 tokens to the Group Account while everyone else in your group chose to contribute 0 tokens to the Group Account. Hence, the total amount of tokens in the Group Account is 6. So your payoff from the Group Account is 30 ECU. You kept 2 tokens in your Private Account, hence, your payoff from the Private Account is 50 ECU. Therefore, your earnings for this task are 50 + 30 = 80 ECU.' class Instructions4(Page): form_model = 'player' form_fields = ['quiz_4'] def error_message(self, values): if values['quiz_4'] != 2: return 'You contributed 0 tokens to the Group Account while everyone else in your group chose to contribute 6 tokens to the Group Account. Hence, the total amount of tokens in the Group Account is 6 x 3 = 18. So your payoff from the Group Account is 90 ECU. You kept all 8 tokens in your Private Account, hence, your payoff from the Private Account is 90 ECU. Therefore, your earnings for this task are 90 + 90 = 180 ECU.' class Contribution(Page): form_model = 'player' form_fields = ['contribution'] def error_message(self, values): if values['contribution'] != 0 and values['contribution'] != 1 and values['contribution'] != 2 and values['contribution'] != 3 and values['contribution'] != 4 and values['contribution'] != 5 and values['contribution'] != 6 and values['contribution'] != 7 and values['contribution'] != 8: return 'Please enter a whole number for your contribution' class Reference(Page): form_model = 'player' form_fields = ['belief_average', 'belief_min', 'belief_max'] def error_message(self, values): if values['belief_average'] != 0 and values['belief_average'] != 1 and values['belief_average'] != 2 and values['belief_average'] != 3 and values['belief_average'] != 4 and values['belief_average'] != 5 and values['belief_average'] != 6 and values['belief_average'] != 7 and values['belief_average'] != 8 and values['belief_min'] != 0 and values['belief_min'] != 1 and values['belief_min'] != 2 and values['belief_min'] != 3 and values['belief_min'] != 4 and values['belief_min'] != 5 and values['belief_min'] != 6 and values['belief_min'] != 7 and values['belief_min'] != 8 and values['belief_max'] != 0 and values['belief_max'] != 1 and values['belief_max'] != 2 and values['belief_max'] != 3 and values['belief_max'] != 4 and values['belief_max'] != 5 and values['belief_max'] != 6 and values['belief_max'] != 7 and values['belief_max'] != 8: return 'Please enter a whole number' class Waiting_screen(WaitPage): after_all_players_arrive = 'set_payoffs' title_text = 'Waiting Screen' body_text = 'Please wait patiently for the experiment to proceed.' class Results(Page): form_model = 'player' form_fields = ['revision'] def error_message(self, values): if values['revision'] != 0 and values['revision'] != 1 and values['revision'] != 2 and values['revision'] != 3 and values['revision'] != 4 and values['revision'] != 5 and values['revision'] != 6 and values['revision'] != 7 and values['revision'] != 8: return 'Please enter a whole number' class Demographics(Page): form_model = 'player' form_fields = ['Strategy', 'Female', 'Male', 'Prefernottoanswer', 'Enterbelow', 'Ethnicity', 'PayID', 'PayIDRepeat'] class End_Payout(Page): form_model = 'player' page_sequence = [Consent, End_no_consent, Survey1, Survey2, Survey3, Survey4, Survey5, Instructions1, Instructions2, Instructions3, Instructions4, Contribution, Reference, Waiting_screen, Results, Demographics, End_Payout]