from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random author = 'Andres Felipe Barinas' doc = """ Third Party Punisher 0 """ class Constants(BaseConstants): name_in_url = 'third_party_null_a' players_per_group = 2 num_rounds = 5 instructionsInicio = 'third_party_null_a/instructionsInicio.html' instructionsGeneralA = 'third_party_null_a/instructionsGeneralA.html' instructionsGeneralB = 'third_party_null_a/instructionsGeneralB.html' instructionsGeneralC = 'third_party_null_a/instructionsGeneralC.html' instructionsEspA = 'third_party_null/InstructionsEspecificA.html' instructionsEspB = 'third_party_null/InstructionsEspecificB.html' instructionsEspC = 'third_party_null/InstructionsEspecificC.html' etapaUnoA = 'third_party_null_a/EtapaUnoA.html' etapaUnoB = 'third_party_null_a/EtapaUnoB.html' etapaUnoC = 'third_party_null_a/EtapaUnoC.html' introGenA = 'third_party_null/instructionsGeneralA.html' introGenB = 'third_party_null/instructionsGeneralB.html' introGenC = 'third_party_null/instructionsGeneralC.html' introEspA = 'third_party_null/instructionsEspecificA.html' introEspB = 'third_party_null/instructionsEspecificB.html' introEspC = 'third_party_null/instructionsEspecificC.html' collapsed = 'third_party_null_a/collapseinstructions.html' PcProdA='third_party_null/PcProcedureA.html' PcProdB='third_party_null/PcProcedureB.html' PcProdC='third_party_null/PcProcedureC.html' endowmentA = c(100) class Subsession(BaseSubsession): def creating_session(self): global paying_round 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 print("la ronda a pagar es", paying_round) for g in self.get_groups(): for p in g.get_players(): p.random_round=paying_round class Group(BaseGroup): sent_amount = models.CurrencyField( choices=[0,10,20,30,40,50] ) expectation_sent= models.CurrencyField( label= "¿Cuántos puntos cree que el participante A le dará a usted?", choices=[0,10,20,30,40,50] ) 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, ) class Player(BasePlayer): survey_4 = models.IntegerField() survey_5 = models.IntegerField() survey_6 = models.IntegerField() survey_8 = models.IntegerField() random_round=models.IntegerField() city = models.StringField() day = models.IntegerField(min=1, max=31) 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() 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) ##Field del pago de la ronda sin coordinación. round_payoff=models.CurrencyField() ##Fields con respecto al los puntos enviados por A a B. bel_sent=models.BooleanField(initial=False) expected_sent_ammount_B=models.CurrencyField(initial=None) global_payoff=models.CurrencyField(initial=None) # **** PAYMENT **** ##Fields for payment idcard1 = models.StringField() expday = models.IntegerField(min=1, max=31) expmonth = models.IntegerField(min=1, max=12) expyear = models.IntegerField() namep = models.StringField() address = models.StringField() depto = models.StringField() cityp = models.StringField() country1 = models.StringField() email = 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() 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"], [32, "GNB Sudameris"], ], 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)