from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'third_party_two' players_per_group = 3 num_rounds = 2 instructionsGeneralA = 'third_party_two/instructionsGeneralA.html' instructionsGeneralB = 'third_party_two/instructionsGeneralB.html' instructionsGeneralC = 'third_party_two/instructionsGeneralC.html' instructionsEspA = 'third_party_two/InstructionsEspecificA.html' instructionsEspB = 'third_party_two/InstructionsEspecificB.html' instructionsEspC = 'third_party_two/InstructionsEspecificC.html' PcProdA='third_party_two/PcProcedureA.html' PcProdB='third_party_two/PcProcedureB.html' PcProdC='third_party_two/PcProcedureC.html' endowmentA=c(100) endowmentC=c(50) multiplication_factor=3 correct_expectations_message=c(3) class Subsession(BaseSubsession): def creating_session(self): self.group_randomly(fixed_id_in_group=True) if self.round_number == 1: paying_round = random.randint(1, Constants.num_rounds) self.session.vars['paying_round'] = paying_round class Group(BaseGroup): sent_amount = models.CurrencyField( choices=[0,10,20,30,40,50] ) deduction_0=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) deduction_10=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) deduction_20=models.CurrencyField( label = "", min=0, max=Constants.endowmentC, ) deduction_30=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) deduction_40=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) deduction_50=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) expectation_sent= models.CurrencyField( label="¿Cuántos puntos le dará a usted?", choices=[0,10,20,30,40,50], min=0, max=Constants.endowmentA, ) expectation_return_0=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) expectation_return_10=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) expectation_return_20=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) expectation_return_30=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) expectation_return_40=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) expectation_return_50=models.CurrencyField( label="", min=0, max=Constants.endowmentC, ) message=models.BooleanField( choices=[ [True,"1"], [False,"2"] ], label="", widget=widgets.RadioSelect, initial=None ) expectation_message=models.BooleanField( label="", choices=[ [True, "1"], [False, "2"] ], widget=widgets.RadioSelect, ) ##Dummy fields, incorporados para corregir el error de la aleatorización de las rondas y los grupos choice_sent=models.CurrencyField() choice_expected_return=models.CurrencyField() choice_message=models.BooleanField() choice_expected_message=models.BooleanField() choice_expected_ded_0=models.CurrencyField() choice_expected_ded_10=models.CurrencyField() choice_expected_ded_20=models.CurrencyField() choice_expected_ded_30=models.CurrencyField() choice_expected_ded_40=models.CurrencyField() choice_expected_ded_50=models.CurrencyField() choice_ded_0=models.CurrencyField() choice_ded_10=models.CurrencyField() choice_ded_20=models.CurrencyField() choice_ded_30=models.CurrencyField() choice_ded_40=models.CurrencyField() choice_ded_50=models.CurrencyField() choice_actual_deduction=models.CurrencyField() expectation_social_norm_s1_B=models.IntegerField( label="", choices=[ [0,"Muy socialmente inapropiada"], [1,"Algo socialmente inapropiada"], [2, "Algo socialmente apropiada"], [3, "Muy socialmente apropiada"] ], widget=widgets.RadioSelect, ) expectation_social_norm_s2_B=models.IntegerField( label="", choices=[ [0,"Muy socialmente inapropiada"], [1,"Algo socialmente inapropiada"], [2, "Algo socialmente apropiada"], [3, "Muy socialmente apropiada"] ], widget=widgets.RadioSelect, ) expectation_social_norm_s3_B=models.IntegerField( label="", choices=[ [0,"Muy socialmente inapropiada"], [1,"Algo socialmente inapropiada"], [2, "Algo socialmente apropiada"], [3, "Muy socialmente apropiada"] ], widget=widgets.RadioSelect, ) expectation_social_norm_s1_C=models.IntegerField( label="", choices=[ [0,"Muy socialmente inapropiada"], [1,"Algo socialmente inapropiada"], [2, "Algo socialmente apropiada"], [3, "Muy socialmente apropiada"] ], widget=widgets.RadioSelect, ) expectation_social_norm_s2_C=models.IntegerField( label="", choices=[ [0,"Muy socialmente inapropiada"], [1,"Algo socialmente inapropiada"], [2, "Algo socialmente apropiada"], [3, "Muy socialmente apropiada"] ], widget=widgets.RadioSelect, ) expectation_social_norm_s3_C=models.IntegerField( label="", choices=[ [0,"Muy socialmente inapropiada"], [1,"Algo socialmente inapropiada"], [2, "Algo socialmente apropiada"], [3, "Muy socialmente apropiada"] ], widget=widgets.RadioSelect, ) class Player(BasePlayer): survey_7=models.IntegerField() def survey_7_negative_error_message(self,value): if not (value==60): return 'Error, el participante A le envió 40 puntos al participante B y el participante C no dedujo ningun punto.' survey_8=models.IntegerField() def survey_8_negative_error_message(self, value): if not (value == 40): return 'Error, el participante A le envió 40 puntos al participante B .' survey_9=models.IntegerField() def survey_9_negative_error_message(self,value): if not (value==50): return 'Error, el participante C no envió ningún punto de deducción.' survey_10=models.IntegerField() def survey_10_negative_error_message(self,value): if not (value==15): return 'Error, recuerde que el número de puntos de deducción se triplican cuando son deducidos.' survey_11=models.IntegerField() def survey_11_negative_error_message(self,value): if not (value==40): return 'Error, el participante A le envió 40 puntos al participante B .' survey_12=models.IntegerField() def survey_12_negative_error_message(self,value): if not (value==35): return 'Error, el participante C envió 15 puntos de deducción.' survey_13=models.IntegerField() survey_14=models.IntegerField() q1=models.IntegerField(label="") q2=models.IntegerField(choices=[[0,"Masculino"],[1,"Femenino"]], widget=widgets.RadioSelect) q3=models.IntegerField(label="") q4=models.StringField(label="") q5=models.IntegerField(choices=[ [0,"Pregrado"], [1,"Posgrado"], ], widget=widgets.RadioSelect ) q6=models.IntegerField(label="") q7=models.IntegerField(choices=[[0,"Sí"],[1,"No"]], widget=widgets.RadioSelect) q8=models.IntegerField(choices=[[0,"Sí"],[1,"No"]], widget=widgets.RadioSelect) q9=models.IntegerField(min=0, max=100) q10=models.IntegerField(label="") q11=models.IntegerField(choices=[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5,"5"],[6,"6"],[7,"7"],[8,"8"],[9,"9"],[10,"10"]], widget=widgets.RadioSelectHorizontal) q12=models.IntegerField(choices=[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5,"5"],[6,"6"],[7,"7"],[8,"8"],[9,"9"],[10,"10"]], widget=widgets.RadioSelectHorizontal) q13=models.IntegerField(choices=[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5,"5"],[6,"6"],[7,"7"],[8,"8"],[9,"9"],[10,"10"]], widget=widgets.RadioSelectHorizontal) q14=models.IntegerField(choices=[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5,"5"],[6,"6"],[7,"7"],[8,"8"],[9,"9"],[10,"10"]], widget=widgets.RadioSelectHorizontal) q15=models.IntegerField(choices=[[0,"1"],[1,"2"],[2,"3"],[3,"4"],[4,"5"],[5,"6"],[6,"No sabe/No Responde"]], widget=widgets.RadioSelect) q16=models.LongStringField(label="") q17=models.LongStringField(label="")