from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import random class Introduction(Page): def is_displayed(self): return self.round_number == 1 class Instructions_Especific(Page): def is_displayed(self): return self.round_number == 1 class Offer(Page): form_model = 'group' form_fields = ['sent_amount'] def is_displayed(self): return self.player.id_in_group==1 def vars_for_template(self): mostrar_ronda = True if self.subsession.round_number == 1: mostrar_ronda = False return dict(mostrar=mostrar_ronda) class Deduction(Page): form_model = 'group' form_fields = ['deduction_0','deduction_10','deduction_20','deduction_30','deduction_40','deduction_50'] def is_displayed(self): return self.player.id_in_group==3 def vars_for_template(self): mostrar_ronda = True if self.subsession.round_number == 1: mostrar_ronda = False return dict(mostrar=mostrar_ronda) class Expectations(Page): form_model = 'group' form_fields = ['expectation_sent', 'expectation_return_0', 'expectation_return_10', 'expectation_return_20', 'expectation_return_30', 'expectation_return_40', 'expectation_return_50'] def is_displayed(self): return self.player.id_in_group==2 def vars_for_template(self): mostrar_ronda = True if self.subsession.round_number == 1: mostrar_ronda = False return dict(mostrar=mostrar_ronda) class WaitForAll(WaitPage): wait_for_all_groups = True title_text="Por favor espere a que el resto de participantes tomen sus decisiones." body_text ="De vez en cuando (cada 30 segundos aproximadamente), por favor oprima el botón de teclado F5 para refrescar la conexión de su computador con el servidor del experimento, y así poder avanzar más rápidamente." class RoundResults(Page): def before_next_page(self): self.group.choice_sent=self.group.sent_amount self.group.choice_expected_return=self.group.expectation_sent self.group.choice_expected_ded_0=self.group.expectation_return_0 self.group.choice_expected_ded_10=self.group.expectation_return_10 self.group.choice_expected_ded_20=self.group.expectation_return_20 self.group.choice_expected_ded_30=self.group.expectation_return_30 self.group.choice_expected_ded_40=self.group.expectation_return_40 self.group.choice_expected_ded_50=self.group.expectation_return_50 self.group.choice_ded_0=self.group.deduction_0 self.group.choice_ded_10=self.group.deduction_10 self.group.choice_ded_20=self.group.deduction_20 self.group.choice_ded_30=self.group.deduction_30 self.group.choice_ded_40=self.group.deduction_40 self.group.choice_ded_50=self.group.deduction_50 if self.group.sent_amount == c(0): self.group.choice_actual_deduction=self.group.deduction_0 elif self.group.sent_amount == c(10): self.group.choice_actual_deduction=self.group.deduction_10 elif self.group.sent_amount == c(20): self.group.choice_actual_deduction=self.group.deduction_20 elif self.group.sent_amount == c(30): self.group.choice_actual_deduction = self.group.deduction_30 elif self.group.sent_amount == c(40): self.group.choice_actual_deduction = self.group.deduction_40 else: self.group.choice_actual_deduction=self.group.deduction_50 def vars_for_template(self): mostrar_ronda = True if self.subsession.round_number == 1: mostrar_ronda = False if self.group.sent_amount == c(0): deduction_points=self.group.deduction_0 elif self.group.sent_amount == c(10): deduction_points=self.group.deduction_10 elif self.group.sent_amount == c(20): deduction_points=self.group.deduction_20 elif self.group.sent_amount == c(30): deduction_points = self.group.deduction_30 elif self.group.sent_amount == c(40): deduction_points = self.group.deduction_40 else: deduction_points=self.group.deduction_50 return dict(round_paymentA= Constants.endowmentA-self.group.sent_amount-deduction_points*Constants.multiplication_factor, round_paymentC=Constants.endowmentC-deduction_points, ded_points=deduction_points, mostrar=mostrar_ronda) class DespuesRondaUno(Page): def is_displayed(self): return self.round_number == 1 class ResultsWaitPage(WaitPage): def is_displayed(self): return self.round_number == Constants.num_rounds def after_all_players_arrive(self): num_round = self.session.vars['paying_round'] group = self.group player_A = group.get_player_by_id(1) player_B = group.get_player_by_id(2) player_C = group.get_player_by_id(3) ded_points = self.group.in_round(num_round).choice_actual_deduction player_A.payoff = (Constants.endowmentA - group.in_round(num_round).choice_sent - Constants.multiplication_factor * ded_points)*2 player_B.payoff = (group.in_round(num_round).choice_sent)*2 player_C.payoff = (Constants.endowmentC - ded_points)*2 # método para coger el vector de los valores de mensaje para la ronda escogida Groups = self.subsession.get_groups() ##Creencias para la cantidad enviada por A. values_sent_ammount = [] for g in Groups: values_sent_ammount.append(g.in_round(num_round).choice_sent) # Vector de modas repetitions_1 = 0 for i in values_sent_ammount: aparitions = values_sent_ammount.count(i) if aparitions > repetitions_1: repetitions_1 = aparitions modes_sent_ammount = [] for i in values_sent_ammount: aparitions = values_sent_ammount.count(i) if aparitions == repetitions_1 and i not in modes_sent_ammount: modes_sent_ammount.append(i) if group.in_round(num_round).choice_expected_return in modes_sent_ammount: player_B.payoff += c(3)*2 ##Creencias para los puntos de deducción de C cuando A envía 0 puntos. values_deduction_0 = [] for g in Groups: values_deduction_0.append(g.in_round(num_round).choice_ded_0) # Vector de modas repetitions_2 = 0 for i in values_deduction_0: aparitions = values_deduction_0.count(i) if aparitions > repetitions_2: repetitions_2 = aparitions modes_sent_ammount_0 = [] for i in values_deduction_0: aparitions = values_deduction_0.count(i) if aparitions == repetitions_2 and i not in modes_sent_ammount_0: modes_sent_ammount_0.append(i) if group.in_round(num_round).choice_expected_ded_0 in modes_sent_ammount_0: player_B.payoff += c(0.5) ##Creencias para los puntos de deducción de C cuando A envía 10 puntos. values_deduction_10 = [] for g in Groups: values_deduction_10.append(g.in_round(num_round).choice_ded_10) # Vector de modas repetitions_3 = 0 for i in values_deduction_10: aparitions = values_deduction_10.count(i) if aparitions > repetitions_3: repetitions_3 = aparitions modes_sent_ammount_10 = [] for i in values_deduction_10: aparitions = values_deduction_10.count(i) if aparitions == repetitions_3 and i not in modes_sent_ammount_10: modes_sent_ammount_10.append(i) if group.in_round(num_round).choice_expected_ded_10 in modes_sent_ammount_10: player_B.payoff += c(0.5) ##Creencias para los puntos de deducción de C cuando A envía 20 puntos. values_deduction_20 = [] for g in Groups: values_deduction_20.append(g.in_round(num_round).choice_ded_20) # Vector de modas repetitions_4 = 0 for i in values_deduction_20: aparitions = values_deduction_20.count(i) if aparitions > repetitions_4: repetitions_4 = aparitions modes_sent_ammount_20 = [] for i in values_deduction_20: aparitions = values_deduction_20.count(i) if aparitions == repetitions_4 and i not in modes_sent_ammount_20: modes_sent_ammount_20.append(i) if group.in_round(num_round).choice_expected_ded_20 in modes_sent_ammount_20: player_B.payoff += c(0.5) ##Creencias para los puntos de deducción de C cuando A envía 30 puntos. values_deduction_30 = [] for g in Groups: values_deduction_30.append(g.in_round(num_round).choice_ded_30) # Vector de modas repetitions_5 = 0 for i in values_deduction_30: aparitions = values_deduction_30.count(i) if aparitions > repetitions_5: repetitions_5 = aparitions modes_sent_ammount_30 = [] for i in values_deduction_30: aparitions = values_deduction_30.count(i) if aparitions == repetitions_5 and i not in modes_sent_ammount_30: modes_sent_ammount_30.append(i) if group.in_round(num_round).choice_expected_ded_30 in modes_sent_ammount_30: player_B.payoff += c(0.5) ##Creencias para los puntos de deducción de C cuando A envía 40 puntos. values_deduction_40 = [] for g in Groups: values_deduction_40.append(g.in_round(num_round).choice_ded_40) # Vector de modas repetitions_6 = 0 for i in values_deduction_40: aparitions = values_deduction_40.count(i) if aparitions > repetitions_6: repetitions_6 = aparitions modes_sent_ammount_40 = [] for i in values_deduction_40: aparitions = values_deduction_40.count(i) if aparitions == repetitions_6 and i not in modes_sent_ammount_40: modes_sent_ammount_40.append(i) if group.in_round(num_round).choice_expected_ded_40 in modes_sent_ammount_40: player_B.payoff += c(0.5) ##Creencias para los puntos de deducción de C cuando A envía 50 puntos. values_deduction_50 = [] for g in Groups: values_deduction_50.append(g.in_round(num_round).choice_ded_50) # Vector de modas repetitions_7 = 0 for i in values_deduction_50: aparitions = values_deduction_50.count(i) if aparitions > repetitions_7: repetitions_7 = aparitions modes_sent_ammount_50 = [] for i in values_deduction_50: aparitions = values_deduction_50.count(i) if aparitions == repetitions_7 and i not in modes_sent_ammount_50: modes_sent_ammount_50.append(i) if group.in_round(num_round).choice_expected_ded_50 in modes_sent_ammount_50: player_B.payoff += c(0.5) ##Creencias para B en la última ronda (normas sociales) matching = random.randint(0, len(Groups) - 2) ##pregunta 1 norms_B_s1 = [] for g in Groups: norms_B_s1.append(g.expectation_social_norm_s1_B) norms_B_s1.remove(group.expectation_social_norm_s1_B) if norms_B_s1[matching] == group.expectation_social_norm_s1_B: player_B.payoff += c(1)*2 ##pregunta 2 norms_B_s2 = [] for g in Groups: norms_B_s2.append(g.expectation_social_norm_s2_B) norms_B_s2.remove(group.expectation_social_norm_s2_B) if norms_B_s2[matching] == group.expectation_social_norm_s2_B: player_B.payoff += c(1)*2 ##Creencias para C en la última ronda (normas sociales) ##pregunta 1 norms_C_s1 = [] for g in Groups: norms_C_s1.append(g.expectation_social_norm_s1_C) norms_C_s1.remove(group.expectation_social_norm_s1_C) if norms_C_s1[matching] == group.expectation_social_norm_s1_C: player_C.payoff += c(1)*2 ##pregunta 2 norms_C_s2 = [] for g in Groups: norms_C_s2.append(g.expectation_social_norm_s2_C) norms_C_s2.remove(group.expectation_social_norm_s2_C) if norms_C_s2[matching] == group.expectation_social_norm_s2_C: player_C.payoff += c(1)*2 class Results(Page): def is_displayed(self): return self.round_number == Constants.num_rounds def vars_for_template(self): num_round = self.session.vars['paying_round'] deduction_points=self.group.in_round(num_round).choice_actual_deduction payoff_B= self.group.in_round(num_round).choice_sent # método para coger el vector de los valores de mensaje para la ronda escogida Groups = self.subsession.get_groups() ##Creencias para la cantidad enviada por A. values_sent_message_A="No" payment_message_deduction = 0 values_sent_ammount = [] for g in Groups: values_sent_ammount.append(g.in_round(num_round).choice_sent) # Vector de modas repetitions_1 = 0 for i in values_sent_ammount: aparitions = values_sent_ammount.count(i) if aparitions > repetitions_1: repetitions_1 = aparitions modes_sent_ammount = [] for i in values_sent_ammount: aparitions = values_sent_ammount.count(i) if aparitions == repetitions_1 and i not in modes_sent_ammount: modes_sent_ammount.append(i) if self.group.in_round(num_round).choice_expected_return in modes_sent_ammount: payment_message_deduction += 3 values_sent_message_A="Sí" else: payment_message_deduction+=0 ##Creencias para los puntos de deducción de C cuando A envía 0 puntos. values_deduction_message_0="No" values_deduction_0 = [] for g in Groups: values_deduction_0.append(g.in_round(num_round).choice_ded_0) # Vector de modas repetitions_2 = 0 for i in values_deduction_0: aparitions = values_deduction_0.count(i) if aparitions > repetitions_2: repetitions_2 = aparitions modes_sent_ammount_0 = [] for i in values_deduction_0: aparitions = values_deduction_0.count(i) if aparitions == repetitions_2 and i not in modes_sent_ammount_0: modes_sent_ammount_0.append(i) if self.group.in_round(num_round).choice_expected_ded_0 in modes_sent_ammount_0: payment_message_deduction += 0.5 values_deduction_message_0="Sí" else: payment_message_deduction+=0 ##Creencias para los puntos de deducción de C cuando A envía 10 puntos. values_deduction_message_10="No" values_deduction_10 = [] for g in Groups: values_deduction_10.append(g.in_round(num_round).choice_ded_10) # Vector de modas repetitions_3 = 0 for i in values_deduction_10: aparitions = values_deduction_10.count(i) if aparitions > repetitions_3: repetitions_3 = aparitions modes_sent_ammount_10 = [] for i in values_deduction_10: aparitions = values_deduction_10.count(i) if aparitions == repetitions_3 and i not in modes_sent_ammount_10: modes_sent_ammount_10.append(i) if self.group.in_round(num_round).choice_expected_ded_10 in modes_sent_ammount_10: payment_message_deduction += 0.5 values_deduction_message_10="Sí" else: payment_message_deduction+=0 ##Creencias para los puntos de deducción de C cuando A envía 20 puntos. values_deduction_message_20="No" values_deduction_20 = [] for g in Groups: values_deduction_20.append(g.in_round(num_round).choice_ded_20) # Vector de modas repetitions_4 = 0 for i in values_deduction_20: aparitions = values_deduction_20.count(i) if aparitions > repetitions_4: repetitions_4 = aparitions modes_sent_ammount_20 = [] for i in values_deduction_20: aparitions = values_deduction_20.count(i) if aparitions == repetitions_4 and i not in modes_sent_ammount_20: modes_sent_ammount_20.append(i) if self.group.in_round(num_round).choice_expected_ded_20 in modes_sent_ammount_20: payment_message_deduction += 0.5 values_deduction_message_20="Sí" else: payment_message_deduction+=0 ##Creencias para los puntos de deducción de C cuando A envía 30 puntos. values_deduction_message_30="No" values_deduction_30 = [] for g in Groups: values_deduction_30.append(g.in_round(num_round).choice_ded_30) # Vector de modas repetitions_5 = 0 for i in values_deduction_30: aparitions = values_deduction_30.count(i) if aparitions > repetitions_5: repetitions_5 = aparitions modes_sent_ammount_30 = [] for i in values_deduction_30: aparitions = values_deduction_30.count(i) if aparitions == repetitions_5 and i not in modes_sent_ammount_30: modes_sent_ammount_30.append(i) if self.group.in_round(num_round).choice_expected_ded_30 in modes_sent_ammount_30: payment_message_deduction += 0.5 values_deduction_message_30="Sí" else: payment_message_deduction+=0 ##Creencias para los puntos de deducción de C cuando A envía 40 puntos. values_deduction_message_40="No" values_deduction_40 = [] for g in Groups: values_deduction_40.append(g.in_round(num_round).choice_ded_40) # Vector de modas repetitions_6 = 0 for i in values_deduction_40: aparitions = values_deduction_40.count(i) if aparitions > repetitions_6: repetitions_6 = aparitions modes_sent_ammount_40 = [] for i in values_deduction_40: aparitions = values_deduction_40.count(i) if aparitions == repetitions_6 and i not in modes_sent_ammount_40: modes_sent_ammount_40.append(i) if self.group.in_round(num_round).choice_expected_ded_40 in modes_sent_ammount_40: payment_message_deduction += 0.5 values_deduction_message_40="Sí" else: payment_message_deduction+=0 ##Creencias para los puntos de deducción de C cuando A envía 50 puntos. values_deduction_message_50="No" values_deduction_50 = [] for g in Groups: values_deduction_50.append(g.in_round(num_round).choice_ded_50) # Vector de modas repetitions_7 = 0 for i in values_deduction_50: aparitions = values_deduction_50.count(i) if aparitions > repetitions_7: repetitions_7 = aparitions modes_sent_ammount_50 = [] for i in values_deduction_50: aparitions = values_deduction_50.count(i) if aparitions == repetitions_7 and i not in modes_sent_ammount_50: modes_sent_ammount_50.append(i) if self.group.in_round(num_round).choice_expected_ded_50 in modes_sent_ammount_50: payment_message_deduction += 0.5 values_deduction_message_50="Sí" else: payment_message_deduction+=0 ##Creencias para B en la última ronda (normas sociales) matching = random.randint(0, len(Groups) - 2) social_norms_B = c(0) ##pregunta 1 norms_B_s1 = [] correct_1_B = "No" for g in Groups: norms_B_s1.append(g.expectation_social_norm_s1_B) norms_B_s1.remove(self.group.expectation_social_norm_s1_B) if norms_B_s1[matching] == self.group.expectation_social_norm_s1_B: social_norms_B = +c(1) correct_1_B = "Sí" ##pregunta 2 norms_B_s2 = [] correct_2_B = "No" for g in Groups: norms_B_s2.append(g.expectation_social_norm_s2_B) norms_B_s2.remove(self.group.expectation_social_norm_s2_B) if norms_B_s2[matching] == self.group.expectation_social_norm_s2_B: social_norms_B += c(1) correct_2_B = "Sí" ##Creencias para C en la última ronda (normas sociales) social_norms_C = c(0) ##pregunta 1 norms_C_s1 = [] correct_1_C = "No" for g in Groups: norms_C_s1.append(g.expectation_social_norm_s1_C) norms_C_s1.remove(self.group.expectation_social_norm_s1_C) if norms_C_s1[matching] == self.group.expectation_social_norm_s1_C: social_norms_C += c(1) correct_1_C = "Sí" ##pregunta 2 norms_C_s2 = [] correct_2_C = "No" for g in Groups: norms_C_s2.append(g.expectation_social_norm_s2_C) norms_C_s2.remove(self.group.expectation_social_norm_s2_C) if norms_C_s2[matching] == self.group.expectation_social_norm_s2_C: social_norms_C += c(1) correct_2_C = "Sí" ##Organización en Labels para la interfaz del jugador. # Normas sociales en la pregunta 1 para B if self.group.expectation_social_norm_s1_B == 0: belief_sn_B1 = "Muy socialmente inapropiada" elif self.group.expectation_social_norm_s1_B == 1: belief_sn_B1 = "Algo socialmente inapropiada" elif self.group.expectation_social_norm_s1_B == 2: belief_sn_B1 = "Algo socialmente apropiada" else: belief_sn_B1 = "Muy socialmente apropiada" # Normas sociales en la pregunta 2 para B if self.group.expectation_social_norm_s2_B == 0: belief_sn_B2 = "Muy socialmente inapropiada" elif self.group.expectation_social_norm_s2_B == 1: belief_sn_B2 = "Algo socialmente inapropiada" elif self.group.expectation_social_norm_s2_B == 2: belief_sn_B2 = "Algo socialmente apropiada" else: belief_sn_B2 = "Muy socialmente apropiada" # Normas sociales en la pregunta 1 para C if self.group.expectation_social_norm_s1_C == 0: belief_sn_C1 = "Muy socialmente inapropiada" elif self.group.expectation_social_norm_s1_C == 1: belief_sn_C1 = "Algo socialmente inapropiada" elif self.group.expectation_social_norm_s1_C == 2: belief_sn_C1 = "Algo socialmente apropiada" else: belief_sn_C1 = "Muy socialmente apropiada" # Normas sociales en la pregunta 2 para C if self.group.expectation_social_norm_s2_C == 0: belief_sn_C2 = "Muy socialmente inapropiada" elif self.group.expectation_social_norm_s2_C == 1: belief_sn_C2 = "Algo socialmente inapropiada" elif self.group.expectation_social_norm_s2_C == 2: belief_sn_C2 = "Algo socialmente apropiada" else: belief_sn_C2 = "Muy socialmente apropiada" # Invocamos al "grupo" en la ronda aleatoria. group = self.group.in_round(num_round) # Sobre las expectativas de B de los puntos envíados por A. if group.expectation_sent == c(0): belief_sent = "0 puntos" elif group.expectation_sent == c(10): belief_sent = "10 puntos" elif group.expectation_sent == c(20): belief_sent = "20 puntos" elif group.expectation_sent == c(30): belief_sent = "30 puntos" elif group.expectation_sent == c(40): belief_sent = "40 puntos" else: belief_sent = "50 puntos" # Expectativas de B de los puntos de deducción enviados por C belief_ded_0 = str(int(group.expectation_return_0)) + " puntos." belief_ded_10 = str(int(group.expectation_return_10)) + " puntos." belief_ded_20 = str(int(group.expectation_return_20)) + " puntos." belief_ded_30 = str(int(group.expectation_return_30)) + " puntos." belief_ded_40 = str(int(group.expectation_return_40)) + " puntos." belief_ded_50 = str(int(group.expectation_return_50)) + " puntos." # Modas de los puntos enviados por A group = self.group player_A = group.get_player_by_id(1) player_B = group.get_player_by_id(2) player_C = group.get_player_by_id(3) player_A_payoff=int(player_A.payoff)/2 player_B_payoff=int(player_B.payoff)/2 player_C_payoff=int(player_C.payoff)/2 return dict( paying_round=num_round, payoff_B=payoff_B, ded_points=deduction_points, social_norms_C=social_norms_C, social_norms_B=social_norms_B, correct_1_C=correct_1_C, correct_1_B=correct_1_B, correct_2_B=correct_2_B, correct_2_C=correct_2_C, payment_message_deduction=payment_message_deduction, belief_sent=belief_sent, belief_ded_0=belief_ded_0, belief_ded_10=belief_ded_10, belief_ded_20=belief_ded_20, belief_ded_30=belief_ded_30, belief_ded_40=belief_ded_40, belief_ded_50=belief_ded_50, belief_sn_B1=belief_sn_B1, belief_sn_B2=belief_sn_B2, belief_sn_C1=belief_sn_C1, belief_sn_C2=belief_sn_C2, player_A_payoff=player_A_payoff, player_B_payoff=player_B_payoff, player_C_payoff=player_C_payoff, values_sent_message_A=values_sent_message_A, values_deduction_message_0=values_deduction_message_0, values_deduction_message_10=values_deduction_message_10, values_deduction_message_20=values_deduction_message_20, values_deduction_message_30=values_deduction_message_30, values_deduction_message_40=values_deduction_message_40, values_deduction_message_50=values_deduction_message_50 ) class Payment(Page): def vars_for_template(self): group = self.group player_A = group.get_player_by_id(1) player_B = group.get_player_by_id(2) player_C = group.get_player_by_id(3) player_A_payoff=int(player_A.payoff)/2 player_B_payoff=int(player_B.payoff)/2 player_C_payoff=int(player_C.payoff)/2 payment=self.participant.payoff.to_real_world_currency(self.session) total=self.participant.payoff_plus_participation_fee() return dict(player_A_payoff=player_A_payoff, player_B_payoff=player_B_payoff, player_C_payoff=player_C_payoff, payment=payment, total=total) def is_displayed(self): return self.round_number == Constants.num_rounds class Survey(Page): form_model = 'player' form_fields = ["survey_7","survey_8","survey_9","survey_10","survey_11","survey_12"] def is_displayed(self): return self.round_number==1 class AfterSurvey(Page): def vars_for_template(self): total_correct=0 correct_7="No" if self.player.survey_7==60: correct_7="Si" total_correct+=1 correct_8="No" if self.player.survey_8==40: correct_8="Si" total_correct+=1 correct_9="No" if self.player.survey_9==50: correct_9="Si" total_correct+=1 correct_10="No" if self.player.survey_10==15: correct_10="Si" total_correct+=1 correct_11="No" if self.player.survey_11==40: correct_11="Si" total_correct+=1 correct_12="No" if self.player.survey_12==35: correct_12="Si" total_correct+=1 show=False if total_correct<6: show =True return dict( correct_7=correct_7, correct_8=correct_8, correct_9=correct_9, correct_10=correct_10, correct_11=correct_11, correct_12=correct_12, total_correct=total_correct, show=show ) def is_displayed(self): return self.round_number==1 class InstructionsLastRoundB(Page): def is_displayed(self): return self.round_number==Constants.num_rounds and self.player.id_in_group==2 class InstructionsLastRoundC(Page): def is_displayed(self): return self.round_number == Constants.num_rounds and self.player.id_in_group == 3 class SocialNormsB(Page): form_model='group' form_fields=["expectation_social_norm_s1_B","expectation_social_norm_s2_B"] def is_displayed(self): return self.round_number==Constants.num_rounds and self.player.id_in_group==2 class SocialNormsC(Page): form_model = 'group' form_fields = ["expectation_social_norm_s1_C", "expectation_social_norm_s2_C"] def is_displayed(self): return self.round_number == Constants.num_rounds and self.player.id_in_group == 3 class Survey2(Page): def is_displayed(self): total_correct = 0 correct_7 = "No" if self.player.survey_7 == 60: correct_7 = "Si" total_correct += 1 correct_8 = "No" if self.player.survey_8 == 40: correct_8 = "Si" total_correct += 1 correct_9 = "No" if self.player.survey_9 == 50: correct_9 = "Si" total_correct += 1 correct_10 = "No" if self.player.survey_10 == 15: correct_10 = "Si" total_correct += 1 correct_11 = "No" if self.player.survey_11 == 40: correct_11 = "Si" total_correct += 1 correct_12 = "No" if self.player.survey_12 == 35: correct_12 = "Si" total_correct += 1 show = False if total_correct < 6: show = True return show and self.round_number==1 form_model = "player" form_fields = ["survey_13","survey_14"] def error_message(self, values): if values["survey_13"]!=50 or values["survey_14"]!=10: return "Tiene un error en por lo menos una respuesta." class WaitForAll_2(WaitPage): wait_for_all_groups = True title_text="Por favor espere a que el resto de participantes tomen sus decisiones." body_text ="De vez en cuando (cada 30 segundos aproximadamente), por favor oprima el botón de teclado F5 para refrescar la conexión de su computador con el servidor del experimento, y así poder avanzar más rápidamente." class WaitForAll_3(WaitPage): wait_for_all_groups = True title_text="Por favor espere a que el resto de participantes tomen sus decisiones." body_text ="De vez en cuando (cada 30 segundos aproximadamente), por favor oprima el botón de teclado F5 para refrescar la conexión de su computador con el servidor del experimento, y así poder avanzar más rápidamente." class PcProcedure(Page): def is_displayed(self): return self.round_number==1 class instructionsEspecificA(Page): def is_displayed(self): return self.round_number==1 and self.player.id_in_group==1 class instructionsEspecificB(Page): def is_displayed(self): return self.round_number==1 and self.player.id_in_group==2 class InstructionsEspecificC(Page): def is_displayed(self): return self.round_number==1 and self.player.id_in_group==3 class Questionnaire_A(Page): form_model = "player" form_fields = ["q1","q2","q3","q4","q5","q6"] def is_displayed(self): return self.round_number==Constants.num_rounds class Questionnaire_B(Page): form_model = "player" form_fields = ["q7","q8","q9","q10","q11","q12","q13","q14","q15"] def is_displayed(self): return self.round_number==Constants.num_rounds class FinalMessage(Page): def is_displayed(self): return self.round_number==Constants.num_rounds page_sequence = [ Introduction, instructionsEspecificA, instructionsEspecificB, InstructionsEspecificC, PcProcedure, Survey, AfterSurvey, Survey2, WaitForAll_2, Offer, Expectations, Deduction, WaitForAll, RoundResults, DespuesRondaUno, InstructionsLastRoundB, InstructionsLastRoundC, SocialNormsB, SocialNormsC, ResultsWaitPage, Results, Payment, Questionnaire_A, Questionnaire_B, FinalMessage ]