from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import csv import random class GroupWaitPage(WaitPage): group_by_arrival_time = True def is_displayed(self): return self.round_number == 1 class A_income(Page): def is_displayed(self): return self.round_number == 1 form_model = 'player' form_fields = ['single_item_income','single_item_income_other','single_item_educ','pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None class A_instructions(Page): def is_displayed(self): return self.round_number == 1 form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class A_is_transgression(Page): def is_displayed(self): return self.round_number == 1 and self.participant.vars['game_role'] == 1 form_model = 'group' form_fields = ['is_transgression','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class D_public_name(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] !=0 and self.round_number == 1 form_model = 'group' form_fields = ['public_name_1','public_name_2','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['public_name_1'] = self.group.public_name_1 self.participant.vars['public_name_2'] = self.group.public_name_2 self.group.ego_update_p_random = random.randint(1,2) self.participant.vars['ego_update_p_random'] = self.group.ego_update_p_random ######################################################## #### PRACTICE SLIDERS & Understand Qs################### ######################################################## class A_responseSample(Page): def is_displayed(self): return self.round_number == 1 form_model = 'player' form_fields = ['be01a_practice','check_be01a_practice','sound_annoying','pass_key'] #change check error messages (combine with below method) def check_be01a_practice_error_message(self, value): if not value: return 'Please make a selection' def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.group.type = self.participant.vars['type'] #self.session.vars['type'] = self.participant.vars['type'] self.group.treatment = self.participant.vars['treatment'] #self.session.vars['treatment'] = self.participant.vars['treatment'] self.group.subtreatment = self.participant.vars['subtreatment'] #self.session.vars['subtreatment'] = self.participant.vars['subtreatment'] self.group.diagnostic = self.participant.vars['diagnostic'] #self.session.vars['diagnostic'] = self.participant.vars['diagnostic'] #randomize #share of woman disobey by income order self.group.h_income_d_first = random.randint(0,1) self.participant.vars['h_income_d_first'] = self.group.h_income_d_first #randomize ego plate type good asked first self.group.ego_plate_good_first = random.randint(1,1) self.participant.vars['ego_plate_good_first'] = self.group.ego_plate_good_first #randomize rounds only once: if self.participant.vars['game_role'] == 1: # public incentivized: #self.group.ego_pub_bean_guess_inc = random.randint(0, 1) #self.participant.vars['ego_pub_bean_guess_inc'] = self.group.ego_pub_bean_guess_inc #shuffle selection rounds round_number_selection = list(range(1, Constants.selection_rounds + 1)) random.shuffle(round_number_selection) # print(round_number_selection) round_number_ego_update = list(range(Constants.selection_rounds+1, Constants.selection_rounds + Constants.ego_update_rounds + 1)) random.shuffle(round_number_ego_update) # print(round_number_ego_update) # shuffle game rounds round_number_game = list(range(Constants.selection_rounds + Constants.ego_update_rounds + 1, Constants.num_npublic_rounds + 1)) random.shuffle(round_number_game) # print(round_number_game) # shuffle public rounds round_number_pub_d0 = list(range(Constants.num_npublic_rounds + 1, Constants.num_npublic_rounds + int(Constants.num_public_rounds / 2) + 1)) random.shuffle(round_number_pub_d0) # print(round_number_pub_d0) round_number_pub_d1 = list(range(Constants.num_npublic_rounds + int(Constants.num_public_rounds / 2) + 1, Constants.num_npublic_rounds + Constants.num_public_rounds + 1)) random.shuffle(round_number_pub_d1) # print(round_number_pub_d1) round_numbers = round_number_selection + round_number_ego_update + round_number_game + round_number_pub_d0 + round_number_pub_d1 #print(round_numbers) self.group.rounds = ','.join(str(r) for r in round_numbers) # set shuffled tasks to players and save is dict for p in self.group.get_players(): p.participant.vars['task_rounds'] = dict(zip(Constants.tasks, round_numbers)) #print(p.participant.vars['task_rounds']) """ class A_responseSampleTran(Page): def is_displayed(self): return self.round_number == 1 and self.session.vars['subtreatment'] == 2 form_model = 'player' form_fields = ['be01b_practice','check_be01b_practice','pass_key'] def check_be01b_practice_error_message(self, value): if not value: return 'Please make a selection' def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None """ class A_understandQ(Page): def is_displayed(self): return self.round_number == 1 form_model = 'player' form_fields = ['u_1','u_2','u_3','u_4','pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None ######################################################## #### Ego Relevancy Questions############################ ######################################################## class A_ego_0_intro(Page): def is_displayed(self): return self.round_number == 1 form_model = 'player' form_fields = ['pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None class A_ego_0_practice(Page): def is_displayed(self): return self.round_number == 1 form_model = 'player' form_fields = ['e_prac','pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_prac'] = self.player.e_prac #### RM Questions ############################################################ class A_ego_1(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_1','pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_1'] = self.player.e_1 class A_ego_2(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_2', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_2'] = self.player.e_2 class A_ego_3(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_3', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_3'] = self.player.e_3 class A_ego_4(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_4', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_4'] = self.player.e_4 class A_ego_5(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_5', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_5'] = self.player.e_5 class A_ego_6(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_6', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_6'] = self.player.e_6 class A_ego_7(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_7', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_7'] = self.player.e_7 class A_ego_8(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_8', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_8'] = self.player.e_8 class A_ego_9(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_9', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_9'] = self.player.e_9 class A_ego_10(Page): def is_displayed(self): return self.participant.vars['male'] == 1 and self.round_number == 1 form_model = 'player' form_fields = ['e_10', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['e_10'] = self.player.e_10 self.player.e_score = + self.participant.vars['e_1'] + self.participant.vars['e_2'] + self.participant.vars['e_3'] \ + self.participant.vars['e_4'] + self.participant.vars['e_5']+ self.participant.vars['e_6'] \ + self.participant.vars['e_7'] + self.participant.vars['e_8'] + self.participant.vars['e_9'] \ + self.participant.vars['e_10'] self.participant.vars['e_score'] = self.player.e_score self.player.e_other_scores = Constants.e_scores_string temp_counter = 0 for i in Constants.e_scores_list: if self.participant.vars['e_score'] < i: temp_counter += 1 self.player.e_rank_actual = temp_counter + 1 self.participant.vars['e_rank_actual'] = self.player.e_rank_actual others = self.player.get_others_in_group() for p in others: p.participant.vars['e_rank_actual_other'] = self.player.e_rank_actual p.participant.vars['e_score_other'] = self.player.e_score self.player.e_high = 1 if self.player.e_rank_actual<6 else 0 self.participant.vars['e_high'] = self.player.e_high for p in others: p.participant.vars['e_high_other'] = self.player.e_high ### RM Questions ######################################################################### ### SI Questions ######################################################################### class A_SI_1(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_1','pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_1'] = self.player.si_1 class A_SI_2(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_2', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_2'] = self.player.si_2 class A_SI_3(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_3', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_3'] = self.player.si_3 class A_SI_4(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_4', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_4'] = self.player.si_4 class A_SI_5(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_5', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_5'] = self.player.si_5 class A_SI_6(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_6', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_6'] = self.player.si_6 class A_SI_7(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_7', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_7'] = self.player.si_7 class A_SI_8(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_8', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_8'] = self.player.si_8 class A_SI_9(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_9', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_9'] = self.player.si_9 class A_SI_10(Page): def is_displayed(self): return self.participant.vars['male'] == 0 and self.round_number == 1 form_model = 'player' form_fields = ['si_10', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.player.pass_key = None self.participant.vars['si_10'] = self.player.si_10 self.player.si_score = + self.participant.vars['si_1'] + self.participant.vars['si_2'] + self.participant.vars['si_3'] \ + self.participant.vars['si_4'] + self.participant.vars['si_5']+ self.participant.vars['si_6'] \ + self.participant.vars['si_7'] + self.participant.vars['si_8'] + self.participant.vars['si_9'] \ + self.participant.vars['si_10'] self.participant.vars['si_score'] = self.player.si_score self.player.si_other_scores = Constants.si_scores_string temp_counter = 0 for i in Constants.si_scores_list: if self.participant.vars['si_score'] < i: temp_counter += 1 self.player.si_rank_actual = temp_counter + 1 self.participant.vars['si_rank_actual'] = self.player.si_rank_actual others = self.player.get_others_in_group() for p in others: p.participant.vars['si_rank_actual_other'] = self.player.si_rank_actual p.participant.vars['si_score_other'] = self.player.si_score self.player.si_high = 1 if self.player.si_rank_actual<6 else 0 self.participant.vars['si_high'] = self.player.si_high for p in others: p.participant.vars['si_high_other'] = self.player.si_high ### SI Questions ######################################################################### class A_ego_11_rank(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.round_number == 1 form_model = 'group' form_fields = ['e_rank','e_score_guess','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['e_rank'] = self.group.e_rank others = self.player.get_others_in_group() for p in others: p.participant.vars['e_rank'] = self.group.e_rank class A_ego_11_rank_pub(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == 1 form_model = 'group' form_fields = ['ego_pub_bean','ego_pub_score','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' class A_ego_11_rank_pub2(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.participant.vars['ego_pub_diff'] == 1 and self.round_number == 1 form_model = 'group' form_fields = ['ego_pub2_bean','ego_pub2_score','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' class A_ego_11_rank_pub_act(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.participant.vars['pub_update_sub'] == 1 and self.round_number == 1 form_model = 'group' form_fields = ['ego_pub_act_score','ego_pub_act_rank','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class A_ego_11_plate_type_1(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.round_number == 1 form_model = 'group' form_fields = ['ego_plate_type_1','plt_type_1_RM_n','plt_type_1_NRM_n','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['ego_plate_type_1'] = self.group.ego_plate_type_1 others = self.player.get_others_in_group() for p in others: p.participant.vars['ego_plate_type_1'] = self.group.ego_plate_type_1 class A_ego_11_plate_type_2(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.round_number == 1 form_model = 'group' form_fields = ['ego_plate_type_2','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['ego_plate_type_2'] = self.group.ego_plate_type_2 others = self.player.get_others_in_group() for p in others: p.participant.vars['ego_plate_type_2'] = self.group.ego_plate_type_2 class A_ego_wait(WaitPage): def is_displayed(self): return self.round_number == 1 ######################################################## #### Selection Questions################################ ######################################################## class B_selectionIntro(Page): def is_displayed(self): #change round number to selection round return self.round_number == 1 and self.participant.vars['game_role'] == 1 and self.participant.vars['diagnostic_type'] == 0 form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class B_selection1G(Page): def is_displayed(self): #change round number to selection round return self.round_number == self.participant.vars['task_rounds']["s1G"] and self.participant.vars['game_role'] == 1 and self.participant.vars['diagnostic_type'] == 0 form_model = 'group' form_fields = ['selection1G','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class B_selection1B(Page): def is_displayed(self): #change round number to selection round return self.round_number == self.participant.vars['task_rounds']["s1B"] and self.participant.vars['game_role'] == 1 and self.participant.vars['diagnostic_type'] == 0 form_model = 'group' form_fields = ['selection1B','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class B_selection2G(Page): def is_displayed(self): #change round number to selection round return self.round_number == self.participant.vars['task_rounds']["s2G"] and self.participant.vars['game_role'] == 1 and self.participant.vars['diagnostic_type'] == 0 form_model = 'group' form_fields = ['selection2G','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class B_selection2B(Page): def is_displayed(self): #change round number to selection round return self.round_number == self.participant.vars['task_rounds']["s2B"] and self.participant.vars['game_role'] == 1 and self.participant.vars['diagnostic_type'] == 0 form_model = 'group' form_fields = ['selection2B','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class A_ego_12_reveal(Page): def is_displayed(self): return self.round_number == (Constants.selection_rounds+1) form_model = 'player' form_fields = ['pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def js_vars(self): if self.participant.vars['opp_male'] == 1: return dict( game_role = self.participant.vars['game_role'], rank_opponent = self.participant.vars['e_high_other'] ) else: return dict( game_role = self.participant.vars['game_role'], rank_opponent = self.participant.vars['si_high_other'] ) def before_next_page(self): self.player.pass_key = None class A_ego_12_elicit_c_score(Page): def is_displayed(self): return self.round_number == (Constants.selection_rounds + 1) and self.participant.vars['game_role'] == 1 and self.participant.vars['elicit_c_score'] == 1 form_model = 'group' form_fields = ['c_score_guess', 'pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class A_ego_12_elicit_c_type(Page): def is_displayed(self): return self.round_number == (Constants.selection_rounds+1) and self.participant.vars['game_role'] == 1 and self.participant.vars['elicit_c_type'] == 1 form_model = 'group' form_fields = ['c_type_guess','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class A_ego_12_chooser_type_reveal(Page): def is_displayed(self): return self.round_number == (Constants.selection_rounds+1) form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def js_vars(self): if self.participant.vars['opp_male'] == 1: return dict( game_role = self.participant.vars['game_role'], opp_male = self.participant.vars['opp_male'], rank_opponent = self.participant.vars['e_high_other'] ) else: return dict( game_role = self.participant.vars['game_role'], opp_male = self.participant.vars['opp_male'], rank_opponent = self.participant.vars['si_high_other'] ) def before_next_page(self): self.group.pass_key = None ''' class A_ego_13_plate_strong(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['subtreatment'] == 1 and self.round_number == (Constants.selection_rounds+1) form_model = 'group' form_fields = ['ego_plate_strong','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' class A_ego_13_rank_update_d0(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["ego_d0_update"] and self.participant.vars['d_update_sub'] == 1 form_model = 'group' form_fields = ['e_rank_update_d0', 'e_score_update_d0','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['e_rank_update_d0'] = self.group.e_rank_update_d0 self.participant.vars['e_score_update_d0'] = self.group.e_score_update_d0 others = self.player.get_others_in_group() for p in others: p.participant.vars['e_rank_update_d0'] = self.group.e_rank_update_d0 p.participant.vars['e_score_update_d0'] = self.group.e_score_update_d0 class A_ego_13_rank_update_pub1_d0(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']["ego_d0_update"] and self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.participant.vars['d_update_sub'] == 1 form_model = 'group' form_fields = ['e_rank_update_d0_p1', 'e_score_update_d0_p1','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['e_rank_update_d0_p1'] = self.group.e_rank_update_d0_p1 self.participant.vars['e_score_update_d0_p1'] = self.group.e_score_update_d0_p1 others = self.player.get_others_in_group() for p in others: p.participant.vars['e_rank_update_d0_p1'] = self.group.e_rank_update_d0_p1 p.participant.vars['e_score_update_d0_p1'] = self.group.e_score_update_d0_p1 ''' class A_ego_13_rank_update_pub2_d0(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']["ego_d0_update"] and self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.participant.vars['e_update_p_diff_d0'] == 1 form_model = 'group' form_fields = ['e_rank_update_d0_p2', 'e_score_update_d0_p2','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['e_rank_update_d0_p2'] = self.group.e_rank_update_d0_p2 self.participant.vars['e_score_update_d0_p2'] = self.group.e_score_update_d0_p2 others = self.player.get_others_in_group() for p in others: p.participant.vars['e_rank_update_d0_p2'] = self.group.e_rank_update_d0_p2 p.participant.vars['e_score_update_d0_p2'] = self.group.e_score_update_d0_p2 ''' class A_ego_13_mood_pub1_d0(Page): def is_displayed(self): return self.participant.vars['mood_sub'] == 1 and self.round_number == self.participant.vars['task_rounds']["ego_d0_update"] and self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 form_model = 'group' form_fields = ['e_mood_d0_p1', 'pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' class A_ego_13_mood_pub2_d0(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']["ego_d0_update"] and self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.participant.vars['e_mood_d0_p_diff']==1 form_model = 'group' form_fields = ['e_mood_d0_p2', 'pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' class A_ego_13_rank_update_pub_act_d0(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']["ego_d0_update"] and self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.participant.vars['pub_update_sub']==1 and self.participant.vars['d_update_sub'] == 1 form_model = 'group' form_fields = ['ego_pub_act_upd_sc_d0','ego_pub_act_upd_rank_d0', 'pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class A_ego_13_rank_update_d1(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["ego_d1_update"] and self.participant.vars['d_update_sub'] == 1 form_model = 'group' form_fields = ['e_rank_update_d1', 'e_score_update_d1','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['e_rank_update_d1'] = self.group.e_rank_update_d1 self.participant.vars['e_score_update_d1'] = self.group.e_score_update_d1 others = self.player.get_others_in_group() for p in others: p.participant.vars['e_rank_update_d1'] = self.group.e_rank_update_d1 p.participant.vars['e_score_update_d1'] = self.group.e_score_update_d1 class A_ego_13_rank_update_pub1_d1(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == self.participant.vars['task_rounds']["ego_d1_update"] and self.participant.vars['d_update_sub'] == 1 form_model = 'group' form_fields = ['e_rank_update_d1_p1', 'e_score_update_d1_p1','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['e_rank_update_d1_p1'] = self.group.e_rank_update_d1_p1 self.participant.vars['e_score_update_d1_p1'] = self.group.e_score_update_d1_p1 others = self.player.get_others_in_group() for p in others: p.participant.vars['e_rank_update_d1_p1'] = self.group.e_rank_update_d1_p1 p.participant.vars['e_score_update_d1_p1'] = self.group.e_score_update_d1_p1 ''' class A_ego_13_rank_update_pub2_d1(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']["ego_d1_update"] and self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.participant.vars['e_update_p_diff_d1'] == 1 form_model = 'group' form_fields = ['e_rank_update_d1_p2', 'e_score_update_d1_p2','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['e_rank_update_d1_p2'] = self.group.e_rank_update_d1_p2 self.participant.vars['e_score_update_d1_p2'] = self.group.e_score_update_d1_p2 others = self.player.get_others_in_group() for p in others: p.participant.vars['e_rank_update_d1_p2'] = self.group.e_rank_update_d1_p2 p.participant.vars['e_score_update_d1_p2'] = self.group.e_score_update_d1_p2 ''' class A_ego_13_mood_pub1_d1(Page): def is_displayed(self): return self.participant.vars['mood_sub']==1 and self.round_number == self.participant.vars['task_rounds']["ego_d1_update"] and self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 form_model = 'group' form_fields = ['e_mood_d1_p1', 'pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' class A_ego_13_mood_pub2_d1(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']["ego_d1_update"] and self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.participant.vars['e_mood_d1_p_diff'] == 1 form_model = 'group' form_fields = ['e_mood_d1_p2', 'pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' class A_ego_13_rank_update_pub_act_d1(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']["ego_d1_update"] and self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.participant.vars['pub_update_sub']==1 and self.participant.vars['d_update_sub'] == 1 form_model = 'group' form_fields = ['ego_pub_act_upd_sc_d1','ego_pub_act_upd_rank_d1', 'pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class A_ego_14_understand(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.round_number == Constants.num_npublic_rounds - Constants.num_schedule_rounds form_model = 'player' form_fields = ['pass_key','u_5','u_6'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None def js_vars(self): return dict( likelihood_pt = self.participant.vars['ego_plate_type_1'], male = self.participant.vars['male'] ) ######################################################## #### EA SCHEDULE RANDOMIZATION START ################### ######################################################## ######################################################## #### Dictator Transfer ################################# ######################################################## class EADictTransfer(Page): def is_displayed(self): return self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 1 and self.round_number == Constants.num_npublic_rounds - Constants.num_schedule_rounds form_model = 'group' form_fields = ['dic_t','check_dic_t', 'pass_key'] def check_be01a_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['dic_t'] = self.group.dic_t others = self.player.get_others_in_group() for p in others: p.participant.vars['dic_t'] = self.group.dic_t self.group.pass_key = None ######################################################## #### EA SCHEDULE RANDOMIZATION START#################### ######################################################## class EAPFixBelief(Page): def is_displayed(self): return False and self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 1 and self.participant.vars['ea_fix_belief'] == 1 and self.round_number == Constants.num_npublic_rounds - Constants.num_schedule_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None #Sound class EAPSoundBad(Page): def is_displayed(self): return self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be01aSB"] form_model = 'group' form_fields = ['be01a','check_be01a', 'pass_key'] def check_be01a_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be01a'] = self.group.be01a others = self.player.get_others_in_group() for p in others: p.participant.vars['be01a'] = self.group.be01a self.group.pass_key = None class EAPSoundGood(Page): def is_displayed(self): return self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be02aSG"] form_model = 'group' form_fields = ['be02a','check_be02a', 'pass_key'] def check_be02a_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be02a'] = self.group.be02a others = self.player.get_others_in_group() for p in others: p.participant.vars['be02a'] = self.group.be02a self.group.pass_key = None #Man money """ class EAPMoneyBad(Page): def is_displayed(self): return self.session.vars['type'] == 0 and self.session.vars['subtreatment'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be01bMB"] form_model = 'group' form_fields = ['be01b','check_be01b', 'pass_key'] def check_be01b_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.session.vars['be01b'] = self.group.be01b self.group.pass_key = None class EAPMoneyGood(Page): def is_displayed(self): return self.session.vars['type'] == 0 and self.session.vars['subtreatment'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be02bMG"] form_model = 'group' form_fields = ['be02b','check_be02b', 'pass_key'] def check_be02b_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.session.vars['be02b'] = self.group.be02b self.group.pass_key = None """ ######################################################## #### EA SCHEDULE RANDOMIZATION END###################### ######################################################## #Chooser waits for punisher to select schedule class EAWaitPagePSchedules(WaitPage): def is_displayed(self): return self.participant.vars['type'] == 0 and self.round_number == Constants.num_npublic_rounds #Why sound chosen class EAP_sound_reason(Page): def is_displayed(self): return self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['sound_reason','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None #Punisher selects likelihood of disobedience class EAPLikelihoodD(Page): def is_displayed(self): return self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 1 and self.participant.vars['d_likelihood_sub'] == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['likelihood_d','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EAPWshare_d_income_1(Page): def is_displayed(self): return False and self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 1 and self.participant.vars['ea_fix_belief'] == 0 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['share_w1_income_d','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EAPWshare_d_income_2(Page): def is_displayed(self): return False and self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 1 and self.participant.vars['ea_fix_belief'] == 0 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['share_w2_income_d','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None #Chooser listens to the punishers schedule based on their selection class EACScheduleListen(Page): def is_displayed(self): return self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 0 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' #pass javascript variables to later compute sound selected in page def js_vars(self): #if self.session.vars['subtreatment'] != 2: return dict( subtreatment = self.participant.vars['subtreatment'], dict_trans = self.participant.vars['dic_t'], sound_bad = self.participant.vars['be01a'], sound_good = self.participant.vars['be02a'] ) #else: # return dict( # subtreatment = self.session.vars['subtreatment'], # sound_bad=self.session.vars['be01a'], # sound_good=self.session.vars['be02a'], # money_bad=self.session.vars['be01b'], # money_good=self.session.vars['be02b'] # ) def before_next_page(self): self.group.pass_key = None class EACselectPlate(Page): def is_displayed(self): return self.participant.vars['game_role'] == 0 and self.participant.vars['type'] == 0 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['be01','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be01'] = self.group.be01 others = self.player.get_others_in_group() for p in others: p.participant.vars['be01'] = self.group.be01 self.group.pass_key = None #Punisher waits till chooser selects a plate class EAWaitPageCselectPlate(WaitPage): def is_displayed(self): return self.participant.vars['type'] == 0 and self.round_number == Constants.num_npublic_rounds #Announce womens selection to man class EAPAnnounceCselection(Page): def is_displayed(self): return self.participant.vars['type'] == 0 and self.participant.vars['game_role'] == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ############################################################################### ## EA ## ## EA ## ## EA ## ## EA ## ## EA ## ## EA ## ## EA ## ## EA ## ############################################################################### ############################################################################### ## EPC ## ## EPC ## ## EPC ## ## EPC ## ## EPC ## ## EPC ## ## EPC ## ## EPC ## ############################################################################### class EPCCselectPlate(Page): def is_displayed(self): return self.participant.vars['game_role'] == 0 and self.participant.vars['type'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['be01','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be01'] = self.group.be01 others = self.player.get_others_in_group() for p in others: p.participant.vars['be01'] = self.group.be01 self.group.pass_key = None class EPCPLikelihoodD(Page): def is_displayed(self): return self.participant.vars['type'] == 1 and self.participant.vars['game_role'] == 1 and self.participant.vars['d_likelihood_sub'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['likelihood_d','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPCPWshare_d_income_1(Page): def is_displayed(self): return False and self.participant.vars['type'] == 1 and self.participant.vars['game_role'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['share_w1_income_d','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPCPWshare_d_income_2(Page): def is_displayed(self): return False and self.participant.vars['type'] == 1 and self.participant.vars['game_role'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['share_w2_income_d','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPCPFixBelief(Page): def is_displayed(self): return False and self.participant.vars['type'] == 1 and self.participant.vars['game_role'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPCWaitPageCselectPlate(WaitPage): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) class EPCPAnnounceCselection(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ######################################################## #### EPC SCHEDULE RANDOMIZATION START################### ######################################################## #Sound class EPCPSoundBad(Page): def is_displayed(self): return self.participant.vars['type'] == 1 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be01aSB"] form_model = 'group' form_fields = ['be01a','check_be01a', 'pass_key'] def check_be01a_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be01a'] = self.group.be01a others = self.player.get_others_in_group() for p in others: p.participant.vars['be01a'] = self.group.be01a self.group.pass_key = None class EPCPSoundGood(Page): def is_displayed(self): return self.participant.vars['type'] == 1 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be02aSG"] form_model = 'group' form_fields = ['be02a','check_be02a', 'pass_key'] def check_be02a_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be02a'] = self.group.be02a others = self.player.get_others_in_group() for p in others: p.participant.vars['be02a'] = self.group.be02a self.group.pass_key = None """ #Money class EPCPMoneyBad(Page): def is_displayed(self): return self.session.vars['type'] == 1 and self.session.vars['subtreatment'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be01bMB"] form_model = 'group' form_fields = ['be01b','check_be01b', 'pass_key'] def check_be01b_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.session.vars['be01b'] = self.group.be01b self.group.pass_key = None class EPCPMoneyGood(Page): def is_displayed(self): return self.session.vars['type'] == 1 and self.session.vars['subtreatment'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be02bMG"] form_model = 'group' form_fields = ['be02b','check_be02b', 'pass_key'] def check_be02b_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.session.vars['be02b'] = self.group.be02b self.group.pass_key = None """ ######################################################## #### EPC SCHEDULE RANDOMIZATION END##################### ######################################################## #Chooser waits for punisher to select schedule class EPCWaitPagePSchedules(WaitPage): def is_displayed(self): return self.participant.vars['type'] == 1 and self.round_number == Constants.num_npublic_rounds class EPCP_sound_reason(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['sound_reason','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPCPAnnounceCselectionReveal(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None #Chooser listens to the punishers schedule based on their selection class EPCCScheduleListen(Page): def is_displayed(self): return self.participant.vars['type'] == 1 and self.participant.vars['game_role'] == 0 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' #pass javascript variables to later compute sound selected in page def js_vars(self): return dict( plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) def before_next_page(self): self.group.pass_key = None """ if self.session.vars['subtreatment'] != 2: return dict( subtreatment = self.session.vars['subtreatment'], plate_selected = self.session.vars['be01'], sound_bad = self.session.vars['be01a'], sound_good = self.session.vars['be02a'] ) else: return dict( subtreatment = self.session.vars['subtreatment'], plate_selected=self.session.vars['be01'], sound_bad=self.session.vars['be01a'], sound_good=self.session.vars['be02a'], money_bad=self.session.vars['be01b'], money_good=self.session.vars['be02b'] ) """ ############################################################################### ## EPC ## ## EPC ## ## EPC ## ## EPC ## ## EPC ## ## EPC ## ## EPC ## ## EPC ## ############################################################################### ############################################################################### ## EPH ## ## EPH ## ## EPH ## ## EPH ## ## EPH ## ## EPH ## ## EPH ## ## EPH ## ############################################################################### class EPHPLikelihoodD(Page): def is_displayed(self): return self.participant.vars['type'] == 2 and self.participant.vars['game_role'] == 1 and self.participant.vars['d_likelihood_sub'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['likelihood_d','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPHPWshare_d_income_1(Page): def is_displayed(self): return False and self.participant.vars['type'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['share_w1_income_d','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPHPWshare_d_income_2(Page): def is_displayed(self): return False and self.participant.vars['type'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['share_w2_income_d','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPHPFixBelief(Page): def is_displayed(self): return False and self.participant.vars['type'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPHPTemperPre(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 2 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['eph_temper_pre','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['eph_temper_pre'] = self.group.eph_temper_pre self.group.pass_key = None class EPHCselectPlate(Page): def is_displayed(self): return self.participant.vars['game_role'] == 0 and self.participant.vars['type'] == 2 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['be01','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be01'] = self.group.be01 others = self.player.get_others_in_group() for p in others: p.participant.vars['be01'] = self.group.be01 self.group.pass_key = None class EPHWaitPageCselectPlate(WaitPage): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 2 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) class EPHPAnnounceCselection(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 2 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['min_pre_announce','sec_pre_announce','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPHPTemperPostA(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 2 and self.round_number == (Constants.selection_rounds+Constants.ego_update_rounds+1) form_model = 'group' form_fields = ['eph_temper_post_a','min_post_announce','sec_post_announce','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['eph_temper_post_a'] = self.group.eph_temper_post_a self.group.pass_key = None ######################################################## #### EPH SCHEDULE RANDOMIZATION START################### ######################################################## #Sound class EPHPSoundBad(Page): def is_displayed(self): return self.participant.vars['type'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be01aSB"] form_model = 'group' form_fields = ['be01a','check_be01a', 'pass_key'] def check_be01a_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be01a'] = self.group.be01a others = self.player.get_others_in_group() for p in others: p.participant.vars['be01a'] = self.group.be01a self.group.pass_key = None class EPHPSoundGood(Page): def is_displayed(self): return self.participant.vars['type'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be02aSG"] form_model = 'group' form_fields = ['be02a','check_be02a', 'pass_key'] def check_be02a_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be02a'] = self.group.be02a others = self.player.get_others_in_group() for p in others: p.participant.vars['be02a'] = self.group.be02a self.group.pass_key = None """ #Money class EPHPMoneyBad(Page): def is_displayed(self): return self.session.vars['type'] == 2 and self.session.vars['subtreatment'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be01bMB"] form_model = 'group' form_fields = ['be01b','check_be01b', 'pass_key'] def check_be01b_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.session.vars['be01b'] = self.group.be01b self.group.pass_key = None class EPHPMoneyGood(Page): def is_displayed(self): return self.session.vars['type'] == 2 and self.session.vars['subtreatment'] == 2 and self.participant.vars['game_role'] == 1 and self.round_number == self.participant.vars['task_rounds']["be02bMG"] form_model = 'group' form_fields = ['be02b','check_be02b', 'pass_key'] def check_be02b_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.session.vars['be02b'] = self.group.be02b self.group.pass_key = None """ ######################################################## #### EPH SCHEDULE RANDOMIZATION END##################### ######################################################## class EPHPTemperPostS(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 2 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['eph_temper_post_s','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['eph_temper_post_s'] = self.group.eph_temper_post_s self.group.pass_key = None class EPHPRegret(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['be_sound_eph_regret','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be_sound_eph_regret'] = self.group.be_sound_eph_regret self.group.pass_key = None others = self.player.get_others_in_group() for p in others: p.participant.vars['be_sound_eph_regret'] = self.group.be_sound_eph_regret def js_vars(self): return dict( plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) class EPHPRegretSound(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1 and self.participant.vars.get('be_sound_eph_regret',0) == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['be_sound_eph_post','check_be_sound_eph_post','pass_key'] def check_be_sound_eph_post_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.participant.vars['be_sound_eph_post'] = self.group.be_sound_eph_post others = self.player.get_others_in_group() for p in others: p.participant.vars['be_sound_eph_post'] = self.group.be_sound_eph_post self.group.pass_key = None #Chooser waits for punisher to select schedule class EPHWaitPagePSchedules(WaitPage): def is_displayed(self): return self.participant.vars['type'] == 2 and self.round_number == Constants.num_npublic_rounds #Chooser listens to the punishers schedule based on their selection class EPHCScheduleListen(Page): def is_displayed(self): return self.participant.vars['type'] == 2 and self.participant.vars['game_role'] == 0 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None #pass javascript variables to later compute sound selected in page def js_vars(self): print(self.participant.vars['eph_elicit_regret']) if self.participant.vars['eph_elicit_regret'] == 0: return dict( eph_elicit_regret = self.participant.vars['eph_elicit_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) elif self.participant.vars['eph_elicit_regret'] == 1 and self.participant.vars.get('be_sound_eph_regret',1) == 0: return dict( eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) else: return dict( eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'], sound_regret=self.participant.vars['be_sound_eph_post'] ) """ if self.session.vars['subtreatment'] != 2: return dict( subtreatment = self.session.vars['subtreatment'], plate_selected = self.session.vars['be01'], sound_bad = self.session.vars['be01a'], sound_good = self.session.vars['be02a'] ) else: return dict( subtreatment = self.session.vars['subtreatment'], plate_selected=self.session.vars['be01'], sound_bad=self.session.vars['be01a'], sound_good=self.session.vars['be02a'], money_bad=self.session.vars['be01b'], money_good=self.session.vars['be02b'] ) """ class EPHPTimeStampPostS(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 2 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['min_post_sch','sec_post_sch','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class EPHP_sound_reason(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['type'] == 2 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['sound_reason','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ############################################################################### ## EPH ## ## EPH ## ## EPH ## ## EPH ## ## EPH ## ## EPH ## ## EPH ## ## EPH ## ############################################################################### ############################################################################### #OUTSIDE (IF APPLICABLE) BEAD, SOUND LISTEN AND RESULTS ####################### ############################################################################### """ class COutsideSelection(Page): def is_displayed(self): return self.session.vars['subtreatment'] == 1 and self.participant.vars['game_role'] == 0 and self.round_number == Constants.num_rounds form_model = 'group' form_fields = ['be03_c', 'pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class WaitPageCOutsideSelection(WaitPage): def is_displayed(self): return self.session.vars['subtreatment'] == 1 and self.round_number == Constants.num_rounds """ class PSoundListenDecide(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'player' form_fields = ['listen_decide_p', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def js_vars(self): if self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 0: return dict( be_type = self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) elif self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1\ and self.participant.vars['be_sound_eph_regret'] == 0: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) elif self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1\ and self.participant.vars['be_sound_eph_regret'] == 1: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'], sound_regret = self.participant.vars['be_sound_eph_post'] ) else: return dict( be_type = self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) def before_next_page(self): self.player.pass_key = None class CSoundListenDecide(Page): def is_displayed(self): return self.participant.vars['game_role'] == 0 and self.round_number == Constants.num_npublic_rounds form_model = 'player' form_fields = ['listen_decide_c', 'pass_key'] def error_message(player, values): if values['pass_key'] != 31: return 'Wrong passcode' def js_vars(self): if self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 0: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'], ) elif self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1 \ and self.participant.vars['be_sound_eph_regret'] == 0: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) elif self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1 \ and self.participant.vars['be_sound_eph_regret'] == 1: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'], sound_regret=self.participant.vars['be_sound_eph_post'] ) else: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) # subtreatment=self.session.vars['subtreatment'], # c_outside=self.group.field_maybe_none("be03_c") def before_next_page(self): self.player.pass_key = None class PSoundListen(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.player.field_maybe_none("listen_decide_p") == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def js_vars(self): if self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 0: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'], ) elif self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1 \ and self.participant.vars['be_sound_eph_regret'] == 0: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) elif self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1 \ and self.participant.vars['be_sound_eph_regret'] == 1: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'], sound_regret=self.participant.vars['be_sound_eph_post'] ) else: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) def before_next_page(self): self.group.pass_key = None class CSoundListen(Page): def is_displayed(self): return self.participant.vars['game_role'] == 0 and self.player.field_maybe_none("listen_decide_c") == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def js_vars(self): if self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 0: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) elif self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1 \ and self.participant.vars['be_sound_eph_regret'] == 0: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) elif self.participant.vars['type'] == 2 and self.participant.vars['eph_elicit_regret'] == 1 \ and self.participant.vars['be_sound_eph_regret'] == 1: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], eph_regret=self.participant.vars['be_sound_eph_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'], sound_regret=self.participant.vars['be_sound_eph_post'] ) else: return dict( be_type=self.participant.vars['type'], eph_elicit_regret=self.participant.vars['eph_elicit_regret'], plate_selected=self.participant.vars['be01'], sound_bad=self.participant.vars['be01a'], sound_good=self.participant.vars['be02a'] ) def before_next_page(self): self.group.pass_key = None """ class PBead(Page): def is_displayed(self): return self.round_number==Constants.num_rounds and self.participant.vars['game_role'] == 1 and (self.session.vars['subtreatment']!=1 or (self.session.vars['subtreatment']==1 and self.group.field_maybe_none("be03_c")!=1)) form_model = 'group' form_fields = ['be03','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class WaitPagePBead(WaitPage): def is_displayed(self): return self.round_number == Constants.num_rounds """ class WaitPagePreResults(WaitPage): def is_displayed(self): return self.round_number == Constants.num_npublic_rounds class PResults(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None """ def js_vars(self): if self.session.vars['subtreatment'] == 2: return dict( plate_selected=self.session.vars['be01'], money_bad=self.session.vars['be01b'], money_good=self.session.vars['be02b'], subtreatment=self.session.vars['subtreatment'], ) else: return dict( plate_selected=self.session.vars['be01'], subtreatment=self.session.vars['subtreatment'], ) """ class CResults(Page): def is_displayed(self): return self.participant.vars['game_role'] == 0 and self.round_number == Constants.num_npublic_rounds form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ############################################################################### ### PUB VARS ## ## PUB VARS ## ## PUB VARS ## ## PUB VARS ## ## PUB VARS ## ### ############################################################################### #Public Income class D_pub1_income(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == Constants.num_npublic_rounds+1 form_model = 'group' form_fields = ['public_income_1','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class D_pub2_income(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == Constants.num_npublic_rounds+1 form_model = 'group' form_fields = ['public_income_2','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' class D_pub1_bean(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == Constants.num_npublic_rounds+1 form_model = 'group' form_fields = ['ego_pub1_bean_guess','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['ego_pub1_bean_guess'] = self.group.ego_pub1_bean_guess ''' #Randomize sound for bad/good plate class D_pub1_soundBad(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == self.participant.vars['task_rounds']["pub1_d1"] form_model = 'group' form_fields = ['pub_be01a_1','check_pub_be01a_1','pub_be01a_diff','pass_key'] def check_pub_be01a_1_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['pub_be01a_diff'] = self.group.pub_be01a_diff if self.group.pub_be01a_diff == 0: self.group.pub_be01a_2 = self.group.pub_be01a_1 class D_pub2_soundBad(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == self.participant.vars['task_rounds']["pub1_d1"] and self.participant.vars['pub_be01a_diff'] == 1 form_model = 'group' form_fields = ['pub_be01a_2','check_pub_be01a_2','pass_key'] def check_pub_be01a_2_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None class D_pub1_soundGood(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == self.participant.vars['task_rounds']["pub1_d0"] form_model = 'group' form_fields = ['pub_be02a_1', 'check_pub_be02a_1','pub_be02a_diff', 'pass_key'] def check_pub_be02a_1_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['pub_be02a_diff'] = self.group.pub_be02a_diff if self.group.pub_be02a_diff == 0: self.group.pub_be02a_2 = self.group.pub_be02a_1 class D_pub2_soundGood(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == self.participant.vars['task_rounds']["pub1_d0"] and self.participant.vars['pub_be02a_diff'] == 1 form_model = 'group' form_fields = ['pub_be02a_2', 'check_pub_be02a_2', 'pass_key'] def check_pub_be02a_2_error_message(self, value): if not value: return 'Please make a selection' def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' class D_pub2_bean(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == Constants.num_npublic_rounds+int(Constants.num_public_rounds/2)+1 form_model = 'group' form_fields = ['ego_pub2_bean_guess','pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None self.participant.vars['ego_pub2_bean_guess'] = self.group.ego_pub2_bean_guess ''' ''' class D_pub_bean_results(Page): def is_displayed(self): return self.participant.vars['game_role'] == 1 and self.participant.vars['treatment'] != 0 and self.round_number == Constants.num_rounds and self.participant.vars['ego_pub_bean_guess_inc'] == 1 form_model = 'group' form_fields = ['pass_key'] def error_message(group, values): if values['pass_key'] != 31: return 'Wrong passcode' def before_next_page(self): self.group.pass_key = None ''' page_sequence = [ GroupWaitPage, A_income, A_instructions, A_is_transgression, D_public_name, A_responseSample, #A_responseSampleTran, A_understandQ, #ER questions A_ego_0_intro, A_ego_0_practice, A_ego_1, A_ego_2, A_ego_3, A_ego_4, A_ego_5, A_ego_6, A_ego_7, A_ego_8, A_ego_9, A_ego_10, A_SI_1, A_SI_2, A_SI_3, A_SI_4, A_SI_5, A_SI_6, A_SI_7, A_SI_8, A_SI_9, A_SI_10, A_ego_11_rank, A_ego_11_rank_pub, #A_ego_11_rank_pub2, A_ego_11_rank_pub_act, A_ego_11_plate_type_1, #A_ego_11_plate_type_2, A_ego_wait, #selection questions #B_selection1B, #B_selection1G, #B_selection2B, #B_selection2G, A_ego_12_elicit_c_score, A_ego_12_elicit_c_type, A_ego_12_reveal, #A_ego_12_chooser_type_reveal, #A_ego_13_plate_strong, A_ego_13_rank_update_d0, A_ego_13_rank_update_pub1_d0, #A_ego_13_rank_update_pub2_d0, A_ego_13_mood_pub1_d0, #A_ego_13_mood_pub2_d0, A_ego_13_rank_update_pub_act_d0, A_ego_13_rank_update_d1, A_ego_13_rank_update_pub1_d1, #A_ego_13_rank_update_pub2_d1, A_ego_13_mood_pub1_d1, #A_ego_13_mood_pub2_d0, A_ego_13_rank_update_pub_act_d1, A_ego_14_understand, ##################################################################### # START EA ##################################################################### EAPFixBelief, EADictTransfer, EAPSoundBad, EAPSoundGood, #EAPMoneyBad, #EAPMoneyGood, EAWaitPagePSchedules, EAP_sound_reason, EAPLikelihoodD, EAPWshare_d_income_1, EAPWshare_d_income_2, EACScheduleListen, EACselectPlate, EAWaitPageCselectPlate, EAPAnnounceCselection, ##################################################################### # START EPC ##################################################################### EPCCselectPlate, EPCPLikelihoodD, EPCPWshare_d_income_1, EPCPWshare_d_income_2, EPCPFixBelief, EPCWaitPageCselectPlate, EPCPAnnounceCselection, EPCPSoundBad, EPCPSoundGood, #EPCPMoneyBad, #EPCPMoneyGood, EPCWaitPagePSchedules, EPCP_sound_reason, EPCPAnnounceCselectionReveal, EPCCScheduleListen, ##################################################################### # START EPH ##################################################################### EPHPLikelihoodD, EPHPWshare_d_income_1, EPHPWshare_d_income_2, EPHPFixBelief, EPHPTemperPre, EPHCselectPlate, EPHWaitPageCselectPlate, EPHPAnnounceCselection, EPHPTemperPostA, EPHPSoundBad, EPHPSoundGood, #EPHPMoneyBad, #EPHPMoneyGood, EPHPTemperPostS, EPHPTimeStampPostS, EPHP_sound_reason, EPHPRegret, EPHPRegretSound, EPHWaitPagePSchedules, EPHCScheduleListen, ##################################################################### # Post schedule and plate selection ##################################################################### #COutsideSelection, #WaitPageCOutsideSelection, PSoundListenDecide, PSoundListen, CSoundListenDecide, CSoundListen, #PBead, #WaitPagePBead, WaitPagePreResults, ##################################################################### # Results ##################################################################### PResults, CResults, ##################################################################### # Public Rounds ##################################################################### D_pub1_income, D_pub2_income, #D_pub1_bean, D_pub1_soundBad, D_pub2_soundBad, D_pub1_soundGood, D_pub2_soundGood, #D_pub2_bean, #D_pub_bean_results ]