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_tree' players_per_group = 3 num_rounds = 5 instructionsGeneralA = 'third_party_two_a/instructionsGeneralA.html' instructionsGeneralB = 'third_party_two_a/instructionsGeneralB.html' instructionsGeneralC = 'third_party_two_a/instructionsGeneralC.html' instructionsEspA = 'third_party_two_a/InstructionsEspecificA.html' instructionsEspB = 'third_party_two_a/InstructionsEspecificB.html' instructionsEspC = 'third_party_two_a/InstructionsEspecificC.html' etapaUnoA = 'third_party_two_a/EtapaUnoA.html' etapaDosA = 'third_party_two_a/EtapaDosA.html' etapaTresA = 'third_party_two_a/EtapaTresA.html' etapaUnoB = 'third_party_two_a/EtapaUnoB.html' etapaDosB = 'third_party_two_a/EtapaDosB.html' etapaTresB = 'third_party_two_a/EtapaTresB.html' etapaUnoC = 'third_party_two_a/EtapaUnoC.html' etapaDosC = 'third_party_two_a/EtapaDosC.html' etapaTresC = 'third_party_two_a/EtapaTresC.html' collapsed = 'third_party_two_a/collapseinstructions.html' PcProdA='third_party_two_a/PcProcedureA.html' PcProdB='third_party_two_a/PcProcedureB.html' PcProdC='third_party_two_a/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): # ************ CONSENTIMIENTO INFORMADO ************ city = models.StringField() day = models.IntegerField(max=31, min=1) month = models.IntegerField(min=1, max=12) year = models.IntegerField(max=2020, min=2020, default=2020) hour = models.IntegerField(min=1, max=12) minutes = models.IntegerField(min=0, max=59) ampm = models.IntegerField( choices=[ [0, 'AM'], [1, 'PM'] ] ) name = models.StringField() signature = models.StringField() idcard = models.StringField() citycard = models.StringField() # ************ CHEQUEO DE QUE ENTENDIERON ************ 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_14=models.IntegerField() # ************ Cuestionario ************ 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="") # ************ PAYMENT ************ ##Fields for payment namep = models.StringField() idcard1 = models.StringField() address = models.StringField() cityp = models.StringField() telephone = models.StringField() dayp = models.IntegerField(min=1, max=31) monthp = models.IntegerField(min=1, max=12) yearp = models.IntegerField(max=2020, min=2020, default=2020) concept = models.StringField() value = models.StringField() signaturep = models.StringField() idcard2 = models.StringField() typepayment = models.BooleanField(choices=[ [True, "Transferencia Bancaria"], [False, "Nequi, Daviplata"], ], widget=widgets.RadioSelectHorizontal, ) platform = models.IntegerField(choices=[ [0, "Nequi"], [1, "Daviplata "], ], widget=widgets.RadioSelectHorizontal, initial=None) telephone_2 = models.StringField(initial=None) bank = models.IntegerField(choices=[ [0, "AV Villas"], [1, "Bancamía"], [2, "Banco Agrario"], [3, "Banco Bancoldex"], [4, "Banco Compartir"], [5, "Banco Coopcentral"], [6, "Banco Falabella"], [7, "Banco Finandina"], [8, "Banco Mundo Mujer"], [9, "Banco Pichincha"], [10, "Banco Procredit Colombia"], [11, "Banco Santander Colombia"], [12, "Banco Serfinanza"], [13, "Banco W"], [14, "Bancolombia"], [15, "Bancoomeva"], [16, "BBVA"], [17, "BNB Paribas"], [18, "Bogotá"], [19, "Caja Social"], [20, "CitiBank"], [21, "Coltefinanciera"], [22, "Compañía Financiera Juriscoop"], [23, "Confiar"], [24, "Cooperativa financiera Contrafa"], [25, "Cooperativa financiera de Antioquia"], [26, "Davivienda"], [27, "ITAU"], [28, "ITAU antes Corpbanca"], [29, "Occidente"], [30, "Popular"], [31, "Scotiabank Colpatria"], ], initial=None) id_bank = models.StringField(initial=None) name_2 = models.StringField(initial=None) account_type = models.BooleanField( choices=[ [True, "Ahorros"], [False, "Corriente"], ], initial=None ) idcard3 = models.StringField(initial=None)