631 lines
18 KiB
Python
631 lines
18 KiB
Python
from otree.api import (
|
||
models,
|
||
widgets,
|
||
BaseConstants,
|
||
BaseSubsession,
|
||
BaseGroup,
|
||
BasePlayer,
|
||
Currency as c,
|
||
currency_range,
|
||
)
|
||
|
||
doc = """
|
||
author = 'Wael Bousselmi'
|
||
Exp E4C
|
||
|
||
version: FR
|
||
"""
|
||
|
||
|
||
class Constants(BaseConstants):
|
||
name_in_url = 'v2_exp_e4c_fr_p5_questfin'
|
||
players_per_group = None
|
||
num_rounds = 1
|
||
|
||
showupfee = 5
|
||
|
||
instructions_GP_template = 'v2_exp_e4c_fr_p5_questfin/instructions.html'
|
||
instructions_BW_template = 'v2_exp_e4c_fr_p5_questfin/Risk_BinsWanger_qc.html'
|
||
|
||
gainriskAred = 8#4
|
||
gainriskBred = 6#3
|
||
gainriskCred = 4#2
|
||
gainriskDred = 2#1
|
||
gainriskEred = 0#0
|
||
|
||
gainriskAgreen = 8#4
|
||
gainriskBgreen = 12#6
|
||
gainriskCgreen = 16#8
|
||
gainriskDgreen = 20#10
|
||
gainriskEgreen = 24#12
|
||
|
||
tauxchange = 0.8 # 1 ecu = 0.8 €
|
||
|
||
|
||
class Subsession(BaseSubsession):
|
||
|
||
def vars_for_admin_report(self):
|
||
report = list()
|
||
for p in self.get_players():
|
||
report.append(dict(id=p.participant.id_in_session,
|
||
label=p.participant.label,
|
||
treatmentname = p.treatmentname,
|
||
jeu_tire=p.jeu_tire,
|
||
jeuname = p.jeuname,
|
||
gainfinal=p.gainfinal,
|
||
gaineur=p.gaineur,
|
||
gainfinaleur=p.gainfinaleur,
|
||
))
|
||
return dict(report=report)
|
||
|
||
|
||
class Group(BaseGroup):
|
||
pass
|
||
|
||
class Player(BasePlayer):
|
||
id_in_group_nn = models.IntegerField()
|
||
|
||
treatment = models.IntegerField()
|
||
treatmentname = models.StringField()
|
||
|
||
langue = models.StringField()
|
||
langue_nn = models.IntegerField()
|
||
|
||
# def role(self):
|
||
# return {1: 'A', 2: 'B'}[self.id_in_group]
|
||
|
||
######### var jeu Binswanger
|
||
choicerisk = models.IntegerField(
|
||
blank=False,
|
||
)
|
||
|
||
choicerisknn = models.StringField()
|
||
tc3 = models.StringField()
|
||
tiragecolor = models.FloatField()
|
||
colorbutton = models.IntegerField()
|
||
colorselect = models.IntegerField()
|
||
colorselectnn = models.StringField()
|
||
gainrisk = models.FloatField()
|
||
gainriskeur = models.FloatField()
|
||
gainriskeurfinal = models.FloatField()
|
||
|
||
q_40_etude = models.IntegerField(
|
||
choices=[
|
||
[1, '1- Arts et/ou littérature'],
|
||
[2, '2- Economie et/ou gestion'],
|
||
[3, '3- Scientifique / ingénierie'],
|
||
[4, '4- Autre'],
|
||
],
|
||
widget=widgets.RadioSelect,
|
||
label="a. Votre domaine d’étude ",
|
||
blank=False
|
||
)
|
||
|
||
q_41_gender = models.IntegerField(
|
||
choices=[
|
||
[1, '1- Femme'],
|
||
[2, '2- Homme'],
|
||
[3, '3- Non-binaire'],
|
||
[4, '4- Ne souhaite pas répondre'],
|
||
],
|
||
widget=widgets.RadioSelect,
|
||
label="b. Vous êtes ",
|
||
blank=False
|
||
)
|
||
|
||
q_42_age = models.IntegerField(
|
||
label="c. Quel âge avez-vous ?",
|
||
blank=False,
|
||
min=15,
|
||
max=100,
|
||
)
|
||
|
||
q_43_nationalite = models.IntegerField(
|
||
choices=[
|
||
[1, "Afghanistan"],
|
||
[2, "Albania"],
|
||
[3, "Algeria"],
|
||
[4, "Andorra"],
|
||
[5, "Angola"],
|
||
[6, "Antigua and Barbuda"],
|
||
[7, "Argentina"],
|
||
[8, "Armenia"],
|
||
[9, "Australia"],
|
||
[10, "Austria"],
|
||
[11, "Azerbaijan"],
|
||
[12, "Bahamas"],
|
||
[13, "Bahrain"],
|
||
[14, "Bangladesh"],
|
||
[15, "Barbados"],
|
||
[16, "Belarus"],
|
||
[17, "Belgium"],
|
||
[18, "Belize"],
|
||
[19, "Benin"],
|
||
[20, "Bhutan"],
|
||
[21, "Bolivia"],
|
||
[22, "Bosnia and Herzegovina"],
|
||
[23, "Botswana"],
|
||
[24, "Brazil"],
|
||
[25, "Brunei Darussalam"],
|
||
[26, "Bulgaria"],
|
||
[27, "Burkina Faso"],
|
||
[28, "Burundi"],
|
||
[29, "Cambodia"],
|
||
[30, "Cameroon"],
|
||
[31, "Canada"],
|
||
[32, "Cape Verde"],
|
||
[33, "Central African Republic"],
|
||
[34, "Chad"],
|
||
[35, "Chile"],
|
||
[36, "China"],
|
||
[37, "Colombia"],
|
||
[38, "Comoros"],
|
||
[39, "Congo, Republic of the..."],
|
||
[40, "Costa Rica"],
|
||
[41, "Côte d'Ivoire"],
|
||
[42, "Croatia"],
|
||
[43, "Cuba"],
|
||
[44, "Cyprus"],
|
||
[45, "Czech Republic"],
|
||
[46, "Democratic People's Republic of Korea"],
|
||
[47, "Democratic Republic of the Congo"],
|
||
[48, "Denmark"],
|
||
[49, "Djibouti"],
|
||
[50, "Dominica"],
|
||
[51, "Dominican Republic"],
|
||
[52, "Ecuador"],
|
||
[53, "Egypt"],
|
||
[54, "El Salvador"],
|
||
[55, "Equatorial Guinea"],
|
||
[56, "Eritrea"],
|
||
[57, "Estonia"],
|
||
[58, "Ethiopia"],
|
||
[59, "Fiji"],
|
||
[60, "Finland"],
|
||
[61, "France"],
|
||
[62, "Gabon"],
|
||
[63, "Gambia"],
|
||
[64, "Georgia"],
|
||
[65, "Germany"],
|
||
[66, "Ghana"],
|
||
[67, "Greece"],
|
||
[68, "Grenada"],
|
||
[69, "Guatemala"],
|
||
[70, "Guinea"],
|
||
[71, "Guinea-Bissau"],
|
||
[72, "Guyana"],
|
||
[73, "Haiti"],
|
||
[74, "Honduras"],
|
||
[75, "Hong Kong (S.A.R.)"],
|
||
[76, "Hungary"],
|
||
[77, "Iceland"],
|
||
[78, "India"],
|
||
[79, "Indonesia"],
|
||
[80, "Iran, Islamic Republic of..."],
|
||
[81, "Iraq"],
|
||
[82, "Ireland"],
|
||
[83, "Israel"],
|
||
[84, "Italy"],
|
||
[85, "Jamaica"],
|
||
[86, "Japan"],
|
||
[87, "Jordan"],
|
||
[88, "Kazakhstan"],
|
||
[89, "Kenya"],
|
||
[90, "Kiribati"],
|
||
[91, "Kuwait"],
|
||
[92, "Kyrgyzstan"],
|
||
[93, "Lao People's Democratic Republic"],
|
||
[94, "Latvia"],
|
||
[95, "Lebanon"],
|
||
[96, "Lesotho"],
|
||
[97, "Liberia"],
|
||
[98, "Libyan Arab Jamahiriya"],
|
||
[99, "Liechtenstein"],
|
||
[100, "Lithuania"],
|
||
[101, "Luxembourg"],
|
||
[102, "Madagascar"],
|
||
[103, "Malawi"],
|
||
[104, "Malaysia"],
|
||
[105, "Maldives"],
|
||
[106, "Mali"],
|
||
[107, "Malta"],
|
||
[108, "Marshall Islands"],
|
||
[109, "Mauritania"],
|
||
[110, "Mauritius"],
|
||
[111, "Mexico"],
|
||
[112, "Micronesia, Federated States of..."],
|
||
[113, "Monaco"],
|
||
[114, "Mongolia"],
|
||
[115, "Montenegro"],
|
||
[116, "Morocco"],
|
||
[117, "Mozambique"],
|
||
[118, "Myanmar"],
|
||
[119, "Namibia"],
|
||
[120, "Nauru"],
|
||
[121, "Nepal"],
|
||
[122, "Netherlands"],
|
||
[123, "New Zealand"],
|
||
[124, "Nicaragua"],
|
||
[125, "Niger"],
|
||
[126, "Nigeria"],
|
||
[127, "North Korea"],
|
||
[128, "Norway"],
|
||
[129, "Oman"],
|
||
[130, "Pakistan"],
|
||
[131, "Palau"],
|
||
[132, "Panama"],
|
||
[133, "Papua New Guinea"],
|
||
[134, "Paraguay"],
|
||
[135, "Peru"],
|
||
[136, "Philippines"],
|
||
[137, "Poland"],
|
||
[138, "Portugal"],
|
||
[139, "Qatar"],
|
||
[140, "Republic of Korea"],
|
||
[141, "Republic of Moldova"],
|
||
[142, "Romania"],
|
||
[143, "Russian Federation"],
|
||
[144, "Rwanda"],
|
||
[145, "Saint Kitts and Nevis"],
|
||
[146, "Saint Lucia"],
|
||
[147, "Saint Vincent and the Grenadines"],
|
||
[148, "Samoa"],
|
||
[149, "San Marino"],
|
||
[150, "Sao Tome and Principe"],
|
||
[151, "Saudi Arabia"],
|
||
[152, "Senegal"],
|
||
[153, "Serbia"],
|
||
[154, "Seychelles"],
|
||
[155, "Sierra Leone"],
|
||
[156, "Singapore"],
|
||
[157, "Slovakia"],
|
||
[158, "Slovenia"],
|
||
[159, "Solomon Islands"],
|
||
[160, "Somalia"],
|
||
[161, "South Africa"],
|
||
[162, "South Korea"],
|
||
[163, "Spain"],
|
||
[164, "Sri Lanka"],
|
||
[165, "Sudan"],
|
||
[166, "Suriname"],
|
||
[167, "Swaziland"],
|
||
[168, "Sweden"],
|
||
[169, "Switzerland"],
|
||
[170, "Syrian Arab Republic"],
|
||
[171, "Tajikistan"],
|
||
[172, "Thailand"],
|
||
[173, "The former Yugoslav Republic of Macedonia"],
|
||
[174, "Timor-Leste"],
|
||
[175, "Togo"],
|
||
[176, "Tonga"],
|
||
[177, "Trinidad and Tobago"],
|
||
[178, "Tunisia"],
|
||
[179, "Turkey"],
|
||
[180, "Turkmenistan"],
|
||
[181, "Tuvalu"],
|
||
[182, "Uganda"],
|
||
[183, "Ukraine"],
|
||
[184, "United Arab Emirates"],
|
||
[185, "United Kingdom of Great Britain and Northern Ireland"],
|
||
[186, "United Republic of Tanzania"],
|
||
[187, "United States of America"],
|
||
[188, "Uruguay"],
|
||
[189, "Uzbekistan"],
|
||
[190, "Vanuatu"],
|
||
[191, "Venezuela, Bolivarian Republic of..."],
|
||
[192, "Viet Nam"],
|
||
[193, "Yemen"],
|
||
[194, "Zambia"],
|
||
[195, "Zimbabwe"],
|
||
],
|
||
blank=False,
|
||
label="d. Pays de nationalité ",
|
||
)
|
||
|
||
q_44_revenu = models.IntegerField(
|
||
choices=[
|
||
[1, '1- Inférieur à 5 000 Euros'],
|
||
[2, '2- Entre 5 000 et 10 000 Euros'],
|
||
[3, '3- Entre 10 000 et 15 000 Euros '],
|
||
[4, '4- Entre 15 000 et 20 000 Euros '],
|
||
[5, '5- Entre 20 000 et 25 000 Euros '],
|
||
[6, '6- Supérieur à 25 000 Euros '],
|
||
],
|
||
widget=widgets.RadioSelect,
|
||
label="e. Veuillez estimer votre revenu annuel brut (y compris vos bourses d'études et votre prêt étudiant) en Euros. ",
|
||
blank=False
|
||
)
|
||
|
||
# q_45_logement_pays = models.StringField(
|
||
# label="Pays - précédent logement ",
|
||
# blank=False
|
||
# )
|
||
|
||
q3_countries = models.IntegerField(
|
||
choices=[
|
||
[1, "Afghanistan"],
|
||
[2, "Albania"],
|
||
[3, "Algeria"],
|
||
[4, "Andorra"],
|
||
[5, "Angola"],
|
||
[6, "Antigua and Barbuda"],
|
||
[7, "Argentina"],
|
||
[8, "Armenia"],
|
||
[9, "Australia"],
|
||
[10, "Austria"],
|
||
[11, "Azerbaijan"],
|
||
[12, "Bahamas"],
|
||
[13, "Bahrain"],
|
||
[14, "Bangladesh"],
|
||
[15, "Barbados"],
|
||
[16, "Belarus"],
|
||
[17, "Belgium"],
|
||
[18, "Belize"],
|
||
[19, "Benin"],
|
||
[20, "Bhutan"],
|
||
[21, "Bolivia"],
|
||
[22, "Bosnia and Herzegovina"],
|
||
[23, "Botswana"],
|
||
[24, "Brazil"],
|
||
[25, "Brunei Darussalam"],
|
||
[26, "Bulgaria"],
|
||
[27, "Burkina Faso"],
|
||
[28, "Burundi"],
|
||
[29, "Cambodia"],
|
||
[30, "Cameroon"],
|
||
[31, "Canada"],
|
||
[32, "Cape Verde"],
|
||
[33, "Central African Republic"],
|
||
[34, "Chad"],
|
||
[35, "Chile"],
|
||
[36, "China"],
|
||
[37, "Colombia"],
|
||
[38, "Comoros"],
|
||
[39, "Congo, Republic of the..."],
|
||
[40, "Costa Rica"],
|
||
[41, "Côte d'Ivoire"],
|
||
[42, "Croatia"],
|
||
[43, "Cuba"],
|
||
[44, "Cyprus"],
|
||
[45, "Czech Republic"],
|
||
[46, "Democratic People's Republic of Korea"],
|
||
[47, "Democratic Republic of the Congo"],
|
||
[48, "Denmark"],
|
||
[49, "Djibouti"],
|
||
[50, "Dominica"],
|
||
[51, "Dominican Republic"],
|
||
[52, "Ecuador"],
|
||
[53, "Egypt"],
|
||
[54, "El Salvador"],
|
||
[55, "Equatorial Guinea"],
|
||
[56, "Eritrea"],
|
||
[57, "Estonia"],
|
||
[58, "Ethiopia"],
|
||
[59, "Fiji"],
|
||
[60, "Finland"],
|
||
[61, "France"],
|
||
[62, "Gabon"],
|
||
[63, "Gambia"],
|
||
[64, "Georgia"],
|
||
[65, "Germany"],
|
||
[66, "Ghana"],
|
||
[67, "Greece"],
|
||
[68, "Grenada"],
|
||
[69, "Guatemala"],
|
||
[70, "Guinea"],
|
||
[71, "Guinea-Bissau"],
|
||
[72, "Guyana"],
|
||
[73, "Haiti"],
|
||
[74, "Honduras"],
|
||
[75, "Hong Kong (S.A.R.)"],
|
||
[76, "Hungary"],
|
||
[77, "Iceland"],
|
||
[78, "India"],
|
||
[79, "Indonesia"],
|
||
[80, "Iran, Islamic Republic of..."],
|
||
[81, "Iraq"],
|
||
[82, "Ireland"],
|
||
[83, "Israel"],
|
||
[84, "Italy"],
|
||
[85, "Jamaica"],
|
||
[86, "Japan"],
|
||
[87, "Jordan"],
|
||
[88, "Kazakhstan"],
|
||
[89, "Kenya"],
|
||
[90, "Kiribati"],
|
||
[91, "Kuwait"],
|
||
[92, "Kyrgyzstan"],
|
||
[93, "Lao People's Democratic Republic"],
|
||
[94, "Latvia"],
|
||
[95, "Lebanon"],
|
||
[96, "Lesotho"],
|
||
[97, "Liberia"],
|
||
[98, "Libyan Arab Jamahiriya"],
|
||
[99, "Liechtenstein"],
|
||
[100, "Lithuania"],
|
||
[101, "Luxembourg"],
|
||
[102, "Madagascar"],
|
||
[103, "Malawi"],
|
||
[104, "Malaysia"],
|
||
[105, "Maldives"],
|
||
[106, "Mali"],
|
||
[107, "Malta"],
|
||
[108, "Marshall Islands"],
|
||
[109, "Mauritania"],
|
||
[110, "Mauritius"],
|
||
[111, "Mexico"],
|
||
[112, "Micronesia, Federated States of..."],
|
||
[113, "Monaco"],
|
||
[114, "Mongolia"],
|
||
[115, "Montenegro"],
|
||
[116, "Morocco"],
|
||
[117, "Mozambique"],
|
||
[118, "Myanmar"],
|
||
[119, "Namibia"],
|
||
[120, "Nauru"],
|
||
[121, "Nepal"],
|
||
[122, "Netherlands"],
|
||
[123, "New Zealand"],
|
||
[124, "Nicaragua"],
|
||
[125, "Niger"],
|
||
[126, "Nigeria"],
|
||
[127, "North Korea"],
|
||
[128, "Norway"],
|
||
[129, "Oman"],
|
||
[130, "Pakistan"],
|
||
[131, "Palau"],
|
||
[132, "Panama"],
|
||
[133, "Papua New Guinea"],
|
||
[134, "Paraguay"],
|
||
[135, "Peru"],
|
||
[136, "Philippines"],
|
||
[137, "Poland"],
|
||
[138, "Portugal"],
|
||
[139, "Qatar"],
|
||
[140, "Republic of Korea"],
|
||
[141, "Republic of Moldova"],
|
||
[142, "Romania"],
|
||
[143, "Russian Federation"],
|
||
[144, "Rwanda"],
|
||
[145, "Saint Kitts and Nevis"],
|
||
[146, "Saint Lucia"],
|
||
[147, "Saint Vincent and the Grenadines"],
|
||
[148, "Samoa"],
|
||
[149, "San Marino"],
|
||
[150, "Sao Tome and Principe"],
|
||
[151, "Saudi Arabia"],
|
||
[152, "Senegal"],
|
||
[153, "Serbia"],
|
||
[154, "Seychelles"],
|
||
[155, "Sierra Leone"],
|
||
[156, "Singapore"],
|
||
[157, "Slovakia"],
|
||
[158, "Slovenia"],
|
||
[159, "Solomon Islands"],
|
||
[160, "Somalia"],
|
||
[161, "South Africa"],
|
||
[162, "South Korea"],
|
||
[163, "Spain"],
|
||
[164, "Sri Lanka"],
|
||
[165, "Sudan"],
|
||
[166, "Suriname"],
|
||
[167, "Swaziland"],
|
||
[168, "Sweden"],
|
||
[169, "Switzerland"],
|
||
[170, "Syrian Arab Republic"],
|
||
[171, "Tajikistan"],
|
||
[172, "Thailand"],
|
||
[173, "The former Yugoslav Republic of Macedonia"],
|
||
[174, "Timor-Leste"],
|
||
[175, "Togo"],
|
||
[176, "Tonga"],
|
||
[177, "Trinidad and Tobago"],
|
||
[178, "Tunisia"],
|
||
[179, "Turkey"],
|
||
[180, "Turkmenistan"],
|
||
[181, "Tuvalu"],
|
||
[182, "Uganda"],
|
||
[183, "Ukraine"],
|
||
[184, "United Arab Emirates"],
|
||
[185, "United Kingdom of Great Britain and Northern Ireland"],
|
||
[186, "United Republic of Tanzania"],
|
||
[187, "United States of America"],
|
||
[188, "Uruguay"],
|
||
[189, "Uzbekistan"],
|
||
[190, "Vanuatu"],
|
||
[191, "Venezuela, Bolivarian Republic of..."],
|
||
[192, "Viet Nam"],
|
||
[193, "Yemen"],
|
||
[194, "Zambia"],
|
||
[195, "Zimbabwe"],
|
||
],
|
||
label="f. Pays - précédent logement ",
|
||
blank=False
|
||
)
|
||
|
||
q_46_logement_ville = models.StringField(
|
||
label="g. Ville - précédent logement ",
|
||
blank=False
|
||
)
|
||
|
||
q_31 = models.IntegerField() # nbre d'enfant ##### a changer q_31_enfant
|
||
|
||
q_47_residence = models.IntegerField(
|
||
label="i. Vous habitez actuellement dans :",
|
||
choices=[
|
||
[1, 'Le Bâtiment 103'],
|
||
[2, 'Une autre résidence'],
|
||
],
|
||
widget=widgets.RadioSelect,
|
||
blank=False
|
||
)
|
||
|
||
q_48_satisfaction = models.IntegerField(
|
||
choices=[
|
||
[1, '1 - Très satisfait(e)'],
|
||
[2, '2 - Satisfait(e)'],
|
||
[3, '3 - Insatisfait(e)'],
|
||
[4, '4 - Très insatisfait(e)'],
|
||
],
|
||
widget=widgets.RadioSelect,
|
||
label="j. Quel est votre niveau de satisfaction concernant votre lieu de résidence ",
|
||
blank=True
|
||
)
|
||
|
||
|
||
q_49_propositions = models.StringField(
|
||
label="k. Avez-vous des idées ou propositions d'améliorations "
|
||
"concernant votre lieu de résidence ? ",
|
||
|
||
blank=True
|
||
)
|
||
|
||
|
||
|
||
### jeu 2 : Gneezy&Potters
|
||
tirageriskresult_j1 = models.StringField()
|
||
risk11_a_j1 = models.FloatField()
|
||
risk11_b_j1 = models.FloatField()
|
||
gainrisk_j1 = models.FloatField()
|
||
|
||
|
||
tirageausort = models.FloatField()
|
||
|
||
jeu_tire = models.IntegerField()
|
||
gainfinal = models.FloatField()
|
||
|
||
|
||
#gainfinalecu = models.FloatField()
|
||
#gainfinalplushowup = models.FloatField()
|
||
gaineur = models.FloatField()
|
||
gainfinaleur = models.FloatField()
|
||
|
||
gainfinaleur_v1 = models.FloatField()
|
||
|
||
jeuname = models.StringField()
|
||
|
||
lastname = models.StringField(
|
||
label="Nom",
|
||
blank=False
|
||
)
|
||
|
||
firstname = models.StringField(
|
||
label="Prénom",
|
||
blank=False
|
||
)
|
||
|
||
email = models.StringField(
|
||
label="Email",
|
||
blank=False
|
||
)
|
||
|
||
room = models.StringField(
|
||
label="Numéro de logement",
|
||
blank=False
|
||
)
|
||
|
||
|
||
|
||
|
||
|