This commit is contained in:
Claire ECOTIERE 2025-03-06 10:28:01 +01:00
parent d2f599e2d0
commit 2e9a9f7d57
571 changed files with 62819 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
venv
staticfiles
./db.sqlite3
.idea
*~
*.sqlite3
_static_root
_bots*s
__temp*
__pycache__/
*.py[cod]
.DS_Store
*.otreezip

View File

@ -0,0 +1,2 @@
web: otree prodserver1of2
worker: otree prodserver2of2

View File

@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}

View File

@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}

View File

@ -0,0 +1 @@
{"people": [{"name": "Scott", "website": "stackabuse.com", "from": "Nebraska"}, {"name": "Larry", "website": "google.com", "from": "Michigan"}, {"name": "Tim", "website": "apple.com", "from": "Alabama"}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,11 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from otree.management.cli import execute_from_command_line
execute_from_command_line(sys.argv, script_file=__file__)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
# oTree-may-overwrite-this-file
# IF YOU MODIFY THIS FILE, remove these comments.
# otherwise, oTree will automatically overwrite it.
otree[mturk]>=3.3.11,<5
psycopg2>=2.8.4
sentry-sdk==0.7.9

View File

@ -0,0 +1,2 @@
# You should put your requirements in requirements.txt instead.
# You can delete this file.

View File

@ -0,0 +1,339 @@
from os import environ
# if you set a property in SESSION_CONFIG_DEFAULTS, it will be inherited by all configs
# in SESSION_CONFIGS, except those that explicitly override it.
# the session config can be accessed from methods in your apps as self.session.config,
# e.g. self.session.config['participation_fee']
#### WB MTURK / session config MTurk #########################
mturk_hit_settings = {
'keywords': ['Survey', 'Game', 'Demographics'], # Questionnaire démographique #'Questionnaire', 'Français'
'title': 'Survey (gain $3.0, duration 7 min)',# Questionnaire démographique
'description': 'You can earn up to $3.0 in approximately 7 minutes.', # Questionnaire démographique: Gain de $0.60 pour une durée de 1 minute.
'frame_height': 500,
'template': 'global/mturk_template.html',
'minutes_allotted_per_assignment': 60,
'expiration_hours': 7*24, # 7 days
# 'grant_qualification_id': '3O3C52ZQEUFOKIZH0662Y397HAFSHV',# Mturk reel Exp G-J ###to prevent retakes
# 'grant_qualification_id': '3ZSPHI510NGVHARBJTEPE3ECGE6IJ2', # Sandbox Exp G-J
'grant_qualification_id': '3IMKSS0I9C91UAW9OSPZY1N2EAQW6A' , # Mturk exp Covid
# 'grant_qualification_id': '3LKGAM13UYJQHAONM1Z1QYBBX0W7ES', # Sandbox exp Covid
# 'grant_qualification_id': '3C2W12C2LIJHOP5OLGDWR8T1PGZURB',# Mturk reel Exp Ines
# 'grant_qualification_id': '3MTUBPNNZX0I8DMRLCRIX5T88L6XMM', # Sandbox Exp Ines
'qualification_requirements': [
{
'QualificationTypeId': "00000000000000000071", # que pour expé Ines ##### workers from the US, 00000000000000000071 is the code for a location-based qualification
'Comparator': "EqualTo",
# 'LocaleValues': [{'Country': "FR"}]
'LocaleValues': [{'Country': "US"}]
},
{
# 'QualificationTypeId': "3O3C52ZQEUFOKIZH0662Y397HAFSHV", # Mturk reel Exp G-J ###To prevent a worker from participating in your study twice
# 'QualificationTypeId': "3ZSPHI510NGVHARBJTEPE3ECGE6IJ2", # Sandbox Exp G-J
# 'QualificationTypeId': '3C2W12C2LIJHOP5OLGDWR8T1PGZURB',# Mturk reel Exp Ines
# 'QualificationTypeId': '3MTUBPNNZX0I8DMRLCRIX5T88L6XMM', # Sandbox Exp Ines
'QualificationTypeId': '3IMKSS0I9C91UAW9OSPZY1N2EAQW6A', # Mturk exp Covid
# 'QualificationTypeId':'3LKGAM13UYJQHAONM1Z1QYBBX0W7ES', # Sandbox exp Covid
'Comparator': "DoesNotExist",
}
]
}
#############################################################################
SESSION_CONFIG_DEFAULTS = {
'real_world_currency_per_point': 0.001,# 0.001 pour exp realeffort et exp covid sinon = 1
'participation_fee': 0,# 0.5 # 0 Expé police
'doc': "",
'mturk_hit_settings': mturk_hit_settings,
}
#############################################################################
SESSION_CONFIGS = [
# dict(
# name='part1_trust',
# display_name='part1_trust',
# num_demo_participants=2,
# app_sequence=['exp_police_part1_trust_v4'],
# ),
# dict(
# name='part2_dictator',
# display_name='part2_dictator',
## num_demo_participants=2,
# app_sequence=['exp_police_part2_dictator_v2'],
# ),
# dict(
# name='part3_TAI',
# display_name='part3_TAI',
# num_demo_participants=2,
# app_sequence=['exp_police_part3_tai'],
# ),
# dict(
# name='part4_trust',
# display_name='part4_trust',
# num_demo_participants=2,
# app_sequence=['exp_police_part4_trust_v3'],
# ),
# dict(
# name='part4bis_trust',
# display_name='part4bis_trust',
# num_demo_participants=2,
# app_sequence=['exp_police_part4bis_trust3'],
# ),
# dict(
# name='part5_6_7_questionnaire',
# display_name='part5_6_7_questionnaire',
# num_demo_participants=2,
# app_sequence=['exp_police_part5_6_7_questionnaire_v2'],
# ),
dict(
name='exp_police_all',
display_name='exp_police_all',
num_demo_participants=2,
app_sequence=['exp_police_part1_trust_v4', 'exp_police_part2_dictator_v2', 'exp_police_part3_tai', 'exp_police_part4_trust_v3', 'exp_police_part4bis_trust3', 'exp_police_part5_6_7_questionnaire_v2', 'payment_info'],
),
# dict(
# name='exp_covid_trust_v3',
# display_name='exp_covid_trust_v3',
# num_demo_participants=1,
# app_sequence=['exp_covid_trust_v3', 'payment_info_mturk'],
# ),
# dict(
# name='exp_e4c_questionnaire',
# display_name='exp_e4c_questionnaire',
# num_demo_participants=1,
# app_sequence=['exp_e4c_questionnaire'],
# ),
# dict(
# name='exp_e4c_risk_binswanger_FR',
# display_name='exp_e4c_risk_binswanger_FR',
# num_demo_participants=1,
# app_sequence=['exp_e4c_risk_binswanger_FR'],
# ),
# dict(
# name='exp_e4c_risk_binswanger',
# display_name='exp_e4c_risk_binswanger',
# num_demo_participants=1,
# app_sequence=['exp_e4c_risk_binswanger'],
# ),
# dict(
# name='exp_e4c_risk_gneezy',
# display_name='exp_e4c_risk_gneezy',
# num_demo_participants=1,
# app_sequence=['exp_e4c_risk_gneezy'],
# ),
# dict(
# name='exp_e4c_questionnaire_final',
# display_name='exp_e4c_questionnaire_final',
# num_demo_participants=1,
# app_sequence=['exp_e4c_questionnaire_final'],
# ),
# dict(
# name='exp_e4c_final_FR',
# display_name='exp_e4c_final_FR',
# num_demo_participants=2,
# app_sequence=['exp_e4c_questionnaire_FR_v2',
# 'exp_e4c_risk_gneezy_FR_v2',
# 'exp_e4c_risk_binswanger_FR_v2',
# 'exp_e4c_risk_gneezy_FR_v2_end',
# 'exp_e4c_questionnaire_final_FR_v2'],
# ),
dict(
name='exp_contact_ih_all',
display_name='exp_contact_ih_all',
num_demo_participants=2,
app_sequence=['exp_contact_ih_part1_v3', 'exp_contact_ih_part2_v3', 'exp_contact_ih_part3_v3', 'exp_contact_ih_part4_v3'],
),
# dict(
# name='exp_contact_ih_part1_test',
# display_name='exp_contact_ih_part1_test',
# num_demo_participants=1,
# app_sequence=['exp_contact_ih_part1_test'],
# ),
# dict(
# name='exp_e4c_final_FR_test',
# display_name='exp_e4c_final_FR_test',
# num_demo_participants=2,
# app_sequence=['exp_e4c_risk_gneezy_FR_v2',
# 'exp_e4c_risk_binswanger_FR_v2',
# 'exp_e4c_risk_gneezy_FR_v2_end',
# 'exp_e4c_questionnaire_final_FR_v2'],
# ),
# dict(
# name='exp_e4c_final_FR_bot',
# display_name='exp_e4c_final_FR_bot',
# num_demo_participants=2,
# app_sequence=['exp_e4c_questionnaire_FR_v2',
# 'exp_e4c_risk_gneezy_FR_v2',
# 'exp_e4c_risk_binswanger_FR_v2',
# 'exp_e4c_risk_gneezy_FR_v2_end',
# 'exp_e4c_questionnaire_final_FR_v2'],
# use_browser_bots=True
# ),
# dict(
# name='exp_e4c_final_EN_bot',
# display_name='exp_e4c_final_EN_bot',
# num_demo_participants=2,
# app_sequence=['exp_e4c_en_p1_quest',
# 'exp_e4c_en_p2_risk_gneezy',
# 'exp_e4c_en_risk_binswanger_v2',
# 'exp_e4c_en_p2bis_risk_gneezy_end',
# 'exp_e4c_en_p5_questfin'],
# use_browser_bots=True
# ),
# dict(
# name='exp_e4c_final_EN',
# display_name='exp_e4c_final_EN',
# num_demo_participants=2,
# app_sequence=['exp_e4c_en_p1_quest',
# 'exp_e4c_en_p2_risk_gneezy',
# 'exp_e4c_en_risk_binswanger_v2',
# 'exp_e4c_en_p2bis_risk_gneezy_end',
# 'exp_e4c_en_p5_questfin'],
# ),
# dict(
# name='exp_e4c_final_test_EN_test',
# display_name='exp_e4c_final_EN_test',
# num_demo_participants=2,
# app_sequence=['exp_e4c_en_p2_risk_gneezy',
# 'exp_e4c_en_risk_binswanger_v2',
# 'exp_e4c_en_p2bis_risk_gneezy_end',
# 'exp_e4c_en_p5_questfin'],
# ),
# dict(
# name='exp_covid_trust_cadrage_v3',
# display_name='exp_covid_trust_cadrage_v3',
# num_demo_participants=1,
# app_sequence=['exp_covid_trust_cadrage_v3', 'payment_info_mturk'],
# ),
# dict(
# name='exp_covid_trust_v3_bot',
# display_name='exp_covid_trust_v3_bot',
# num_demo_participants=1,
# app_sequence=['exp_covid_trust_v3'],
# use_browser_bots=True
# ),
# dict(
# name='exp_covid_trust_cadrage_v3_bot',
# display_name='exp_covid_trust_cadrage_v3_bot',
# num_demo_participants=1,
# app_sequence=['exp_covid_trust_cadrage_v3'],
# use_browser_bots=True
# ),
# dict(
# name='exp_police_all_bot',
# display_name='exp_police_all_bot',
# num_demo_participants=2,
# app_sequence=['exp_police_part1_trust_v4', 'exp_police_part2_dictator_v2', 'exp_police_part3_tai',
# 'exp_police_part4_trust_v3', 'exp_police_part4bis_trust3',
# 'exp_police_part5_6_7_questionnaire_v2', 'payment_info'],
# use_browser_bots=True
# ),
# dict(
# name='exp_etienne_test4',
# display_name='exp_etienne Off_the_record (test)',
# num_demo_participants=1,
# app_sequence=['exp_etienne_test4'],
# ),
# dict(
# name='trust',
# display_name='trust',
# num_demo_participants=2,
# app_sequence=['trust'],
# ),
dict(
name='expines_test17',
display_name='expines_test17',
num_demo_participants=2,
app_sequence=['expines_test17'],
),
]
# ISO-639 code
# for example: de, fr, ja, ko, zh-hans
LANGUAGE_CODE = 'en' #en # 'fr' pour Exp Mindfullness et exp police
# e.g. EUR, GBP, CNY, JPY
REAL_WORLD_CURRENCY_CODE = 'USD' # EUR pour Exp Mindfullness
USE_POINTS = True # False
ROOMS = [
dict(
name="labeds",
display_name="labeds",
participant_label_file="_rooms/labeds.txt"
),
]
#ADMIN_USERNAME = 'admin'
ADMIN_USERNAME = 'wael bousselmi'
# for security, best to set admin password in an environment variable
ADMIN_PASSWORD = environ.get('OTREE_ADMIN_PASSWORD')
DEMO_PAGE_INTRO_HTML = """
Here are some oTree games.
"""
# don't share this with anybody.
SECRET_KEY = 'nm5eaornndp(_0bt_64k+03(-f-n%4bir_+==$8i7&-o$th2@)'
INSTALLED_APPS = ['otree']
AWS_ACCESS_KEY_ID = environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = environ.get('AWS_SECRET_ACCESS_KEY')

2
Procfile Normal file
View File

@ -0,0 +1,2 @@
web: otree prodserver1of2
worker: otree prodserver2of2

40
_rooms/labeds.txt Normal file
View File

@ -0,0 +1,40 @@
labeds1
labeds2
labeds3
labeds4
labeds5
labeds6
labeds7
labeds8
labeds9
labeds10
labeds11
labeds12
labeds13
labeds14
labeds15
labeds16
labeds17
labeds18
labeds19
labeds20
labeds21
labeds22
labeds23
labeds24
labeds25
labeds26
labeds27
labeds28
labeds29
labeds30
labeds31
labeds32
labeds33
labeds34
labeds35
labeds36
labeds37
labeds38
labeds39
labeds40

BIN
_static/Police_car.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
_static/asso1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
_static/asso2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
_static/asso3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

BIN
_static/contact/image1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
_static/contact/image2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
_static/dictator_game.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

BIN
_static/expines/coin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

0
_static/global/empty.css Normal file
View File

View File

@ -0,0 +1,9 @@
.rotate90 {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
float: left;
margin-top: 1em; // TODO: do not hardcode to center align
}

BIN
_static/police1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
_static/police10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
_static/police2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
_static/police3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
_static/police4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
_static/police5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
_static/police6.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
_static/police7.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
_static/police8.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
_static/police9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
_static/sante1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 KiB

BIN
_static/sante10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
_static/sante2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
_static/sante3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
_static/sante4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
_static/sante5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
_static/sante6.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
_static/sante7.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 KiB

BIN
_static/sante8.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
_static/sante9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
_static/trust_game.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

View File

@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}

View File

@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}

View File

@ -0,0 +1,8 @@
{% extends "otree/Page.html" %}
{% load otree static %}
{% block global_styles %}
{% endblock %}
{% block global_scripts %}
{% endblock %}

View File

@ -0,0 +1,23 @@
<script src="https://assets.crowd.aws/crowd-html-elements.js"></script>
<crowd-form>
<div style="padding: 20px">
<p>
Cette tâche consiste à répondre à un questionnaire d'une durée de 1 minute.
Après avoir terminé ce HIT, vous recevrez votre rémunération.
</p>
<p>
L'URL de l'étude apparaît ici: <b><a class="otree-link">link</a></b>.
</p>
<p>
<h1> Important </h1>
<br>
A la dernière page, vous recevrez un code.
Veuillez copier / coller ce code ci-dessous.
</p>
<crowd-input name="completion_code" label="Enter your completion code here" required></crowd-input>
<br>
</div>
</crowd-form>

View File

View File

@ -0,0 +1,20 @@
# Don't change anything in this file.
from .. import models
import otree.api
class Page(otree.api.Page):
subsession: models.Subsession
group: models.Group
player: models.Player
class WaitPage(otree.api.WaitPage):
subsession: models.Subsession
group: models.Group
class Bot(otree.api.Bot):
subsession: models.Subsession
group: models.Group
player: models.Player

797
a1_en_p1_quest/models.py Normal file
View File

@ -0,0 +1,797 @@
from otree.api import (
models,
widgets,
BaseConstants,
BaseSubsession,
BaseGroup,
BasePlayer,
Currency as c,
currency_range,
)
doc = """
author = 'Wael Bousselmi'
Exp E4C
"""
class Constants(BaseConstants):
name_in_url = 'a1_en_p1_quest'
players_per_group = None
num_rounds = 1
showupfee = 0
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,
))
return dict(report=report)
class Group(BaseGroup):
pass
class Player(BasePlayer):
def role(self):
return {1: 'A', 2: 'B'}[self.id_in_group]
treatment = models.IntegerField()
################################################ page Questionnaire 0
game_num = models.IntegerField()
app_sequence_select = models.IntegerField()
questionnaire_before = models.IntegerField()
language = models.StringField()
q_1 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_2_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_22 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_e_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_e_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_e_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_h = models.StringField(
label="",
blank=True
)
q_3 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_4 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_5 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
# q_6 = models.IntegerField(
# choices=[
# [1, '1'],
# [2, '2'],
# [3, '3'],
# [4, '4'],
# [5, '5'],
# [6, '6'],
# ],
# widget=widgets.RadioSelectHorizontal,
# label="",
# blank=False
# )
q_6 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
[5, '5 - I dont drink coffee (or the) at school/work'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_7 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_8 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_9 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_10 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
# q_11 = models.IntegerField(
# choices=[
# [1, '1 - Jamais'],
# [2, '2 - Rarement'],
# [3, '3 - Souvent'],
# [4, '4 - Toujours'],
# ],
# widget=widgets.RadioSelect,
# label="",
# blank=False
# )
q_11 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
[5, '5 - I dont use batteries'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
################################################ page Questionnaire 1
q_12 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_13 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_14 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_15 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
# q_16 = models.IntegerField(
# choices=[
# [1, '1 - Never'],
# [2, '2 - Rarely'],
# [3, '3 - Often'],
# [4, '4 - Always'],
# ],
# widget=widgets.RadioSelect,
# label="",
# blank=False
# )
#
# q_17 = models.IntegerField(
# choices=[
# [1, '1 - Never'],
# [2, '2 - Rarely'],
# [3, '3 - Often'],
# [4, '4 - Always'],
# ],
# widget=widgets.RadioSelect,
# label="",
# blank=False
# )
#
# q_18 = models.IntegerField(
# choices=[
# [1, '1 - Never'],
# [2, '2 - Rarely'],
# [3, '3 - Often'],
# [4, '4 - Always'],
# ],
# widget=widgets.RadioSelect,
# label="",
# blank=False
# )
q_16 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_16_a = models.IntegerField(
label="",
blank=True
)
q_16_b = models.StringField(
label="",
blank=True
)
q_17 = models.IntegerField(
choices=[
[1, 'a- Green (100% electric or hybrid) (€26 per ride)'],
[2, 'b- UberX (Economical, fast and reliable) (at €22 per ride) '],
[3, 'c- Comfort (spacious vehicles and top rated drivers) (at €30 per ride)'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_18 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_19_p2 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_20 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
[5, '5 - I dont drive'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
################################################# Page : Questionnaire2
q_21 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_22_n = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_23 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_24 = models.IntegerField(
choices=[
[0, 'Oui'],
[1, 'Non'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_24_a = models.StringField(
label="If yes which one? ",
blank=True
)
q_25 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_26_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
[7, '7'],
[8, '8'],
[9, '9'],
[10, '10'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_26_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
[7, '7'],
[8, '8'],
[9, '9'],
[10, '10'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_26_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
[7, '7'],
[8, '8'],
[9, '9'],
[10, '10'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_26_d = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
[7, '7'],
[8, '8'],
[9, '9'],
[10, '10'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
# ------------- à modifier ici !!!!!!
q_27_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_27_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_27_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_27_d = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_d = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_e = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_f = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_29_a = models.IntegerField(
label="",
blank=False
)
q_29_b = models.IntegerField(
label="",
blank=False
)
q_29_c = models.IntegerField(
label="",
blank=False
)
q_29_d = models.IntegerField(
label="",
blank=False
)
q_30 = models.IntegerField(
choices=[
[0, 'Yes'],
[1, 'No'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_31 = models.StringField(
label="31) What does this mean for you?",
)

68
a1_en_p1_quest/pages.py Normal file
View File

@ -0,0 +1,68 @@
from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants
import random
import time
class Bienvenue(Page):
form_model = 'player'
form_fields = []
def is_displayed(self):
return self.player.participant.vars['questionnaire_before'] == 1
def before_next_page(self):
self.player.game_num = self.player.participant.vars['game_num']
self.player.app_sequence_select = self.player.participant.vars['app_sequence_select']
self.player.questionnaire_before = self.player.participant.vars['questionnaire_before']
class Questionnaire0(Page):
form_model = 'player'
form_fields = ['q_1', 'q_2_a', 'q_2_b', 'q_2_c',
'q_22', 'q_2_e_a', 'q_2_e_b', 'q_2_e_c', 'q_2_h',
'q_3', 'q_4', 'q_5', 'q_6',
'q_7', 'q_8', 'q_9', 'q_10', 'q_11',
]
def is_displayed(self):
return self.player.participant.vars['questionnaire_before'] == 1
class Questionnaire1(Page):
form_model = 'player'
form_fields = [
'q_12', 'q_13', 'q_14', 'q_15',
'q_16',
'q_16_a','q_16_b', 'q_17',
'q_18',
'q_19_p2', 'q_20',
]
def is_displayed(self):
return self.player.participant.vars['questionnaire_before'] == 1
class Questionnaire2(Page):
form_model = 'player'
form_fields = [ 'q_21', 'q_22_n', 'q_23', 'q_24',
'q_24_a', 'q_25',
'q_26_a', 'q_26_b',
'q_26_c', 'q_26_d',
'q_27_a', 'q_27_b', 'q_27_c',
'q_27_d',
'q_28_a', 'q_28_b', 'q_28_c',
'q_28_d', 'q_28_e', 'q_28_f',
'q_29_a', 'q_29_b','q_29_c', 'q_29_d',
'q_30', 'q_31'
]
def is_displayed(self):
return self.player.participant.vars['questionnaire_before'] == 1
page_sequence = [
Bienvenue,
Questionnaire0,
Questionnaire1,
Questionnaire2,
]

View File

@ -0,0 +1,41 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
<h3>
Please click on the "Next" button to go to the next step
</h3>
</p>
<p>{% next_button %}</p>
</div></div>
{% endblock %}

View File

@ -0,0 +1,228 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Questionnaire (1/3)
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
The answers to the following questions will not be taken into account when calculating your winnings.
However, we ask that you answer as honestly as possible. As a reminder, all your answers will
be treated anonymously, and no one will have access to your answers.
<br><br>
<div class="card bg-light m-3">
<div class="card-body">
<p>
<b>1)
Do you buy organic and / or ecological products?
</b>
{% formfield player.q_1 %}
</p>
<br>
<p>
<b> 2) For each of the following criteria, please indicate if it can influence your choice to buy a product:
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td colspan=3><b>a. The price</b> can influence your choices of products to buy </td>
</tr>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_2_a %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3><b>b. The origin</b> can influence your choices of products to buy </td>
</tr>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_2_b %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3><b>c. The quality</b> can influence your choices of products to buy </td>
</tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_2_c %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3> <b>d. The taste (if it is a food product) </b> can influence your choices of products to buy </td>
</tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_22 %} </td>
<td> Strongly agree</td>
</tr>
<th colspan=3>e. Label influence: </th>
</tr>
<tr>
<td colspan=3>
&nbsp &nbsp &nbsp &nbsp &nbsp <b>* The organic label</b> can influence your choices of products to buy
<br> <b>* Organic label:</b>
<i> An organic product is a product from organic farming (it is an agricultural production
method that excludes the use of most synthetic chemicals, toxic products, etc.).
There is a label (AB) in France that authenticates products from this method of
agriculture. </i>
</td>
</tr>
<tr>
<td> &nbsp &nbsp &nbsp &nbsp Strongly disagree </td>
<td> {% formfield player.q_2_e_a %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3>
&nbsp &nbsp &nbsp &nbsp &nbsp <b>* The ecological label</b> can influence your choices of products to buy
<br> <b>* Ecological label:</b>
<i> An ecological product is a product that will be thought out, designed,
packaged, distributed, recycled in such a way as to minimize the impact on the environment.
It must comply with many rules related to these steps during specifications drawn up by
an organization such as ECOLABEL or ECOCERT.
An ecological product must be designed with maximum respect for the environment
(respect linked to the use of raw materials and machines during manufacture).
The life cycle of the product as well as its recycling are also important points
to consider. </i>
</td>
</tr>
<tr>
<td> &nbsp &nbsp &nbsp &nbsp Strongly disagree </td>
<td> {% formfield player.q_2_e_b %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3>
&nbsp &nbsp &nbsp &nbsp &nbsp <b>* The equitable trade label</b> can influence your choices of products to buy
<br> <b>* Equitable trade label: </b>
<i> Equitable trade is a commercial and international partnership, based on concrete principles and launched
almost 20 years ago. Its objective is to be able to guarantee a better balance between
producers and resellers, by ensuring better working conditions and better remuneration
for small producers. </i>
</tr>
<tr>
<td> &nbsp &nbsp &nbsp &nbsp Strongly disagree </td>
<td> {% formfield player.q_2_e_c %} </td>
<td> Strongly agree</td>
</tr>
</table>
<p>
&nbsp &nbsp &nbsp &nbsp &nbsp *
<b>Other label can influence your choices of
products to buy </b>(if yes, to indicate)
{% formfield player.q_2_h %}
</p>
<p>
<b> 3) Do you shop online ? </b>
{% formfield player.q_3 %}
</p>
<p>
<b> 4) Do you shop clothes online? </b>
{% formfield player.q_4 %}
</p>
<p>
<b>5)
Do you agree that it is less
environmentally friendly to shop online rather than in-store?
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_5 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>6) Do you bring your own cup of coffee (tea) to school/work (instead of using the
cups from the coffee machine)? </b>
{% formfield player.q_6 %}
</p>
<p>
<b>7) Do you sort your household waste? </b>
{% formfield player.q_7 %}
</p>
<p>
<b> 8) Do you use a compost bin? </b>
{% formfield player.q_8 %}
</p>
<p>
<b>9) Do you collect and recycle used paper? </b>
{% formfield player.q_9 %}
</p>
<p>
<b>10) Do you reuse your shopping bags? </b>
{% formfield player.q_10 %}
</p>
<p>
<b>11) Do you return used batteries to appropriate recycling points? </b>
{% formfield player.q_11 %}
</p>
<p>{% next_button %}</p>
</div></div>
</div></div>
{% endblock %}
{% block scripts %}
<script>
function show101(){
document.getElementById('div10').style.display ='none';
}
function show102(){
document.getElementById('div10').style.display = 'block';
}
</script>
{% endblock %}

View File

@ -0,0 +1,150 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Questionnaire (2/3)
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
The answers to the following questions will not be taken into account when calculating your winnings.
However, we ask that you answer as honestly as possible. As a reminder, all your answers will
be treated anonymously, and no one will have access to your answers.
<p>
The questions in this section relate to your habits as a student, i.e. they do not refer to the facilities in your accommodation prior to building 103. On the other hand, the "you" refers to yourself, and not to all the residents of your flat if it is a shared flat.
</p>
<br><br>
<div class="card bg-light m-3">
<div class="card-body">
<p>
<b>12) When buying new electronic devices, do you make sure to buy the ones that use the least amount of energy? </b>
{% formfield player.q_12 %}
</p>
<p>
<b>13) Do you switch off or completely disconnect electrical devices when not in use (without using the
standby mode)? </b>
{% formfield player.q_13 %}
</p>
<p>
<b>14) Do you use a dryer for your clothes? </b>
{% formfield player.q_14 %}
</p>
<p>
<b>15) Do you wait until you have a full charge before doing your laundry? </b>
{% formfield player.q_15 %}
</p>
<p><b> 16) Do you regularly defrost the fridge? </b></p>
<input type="radio" name="q_16" value="1" onclick="show102();" />1 - Never <div id="div10" class="hide">
<hr>
<p> &nbsp &nbsp &nbsp &nbsp <input type="radio" name="q_16_a" value="1" />a - Because I bought a frost free fridge on purpose <br>
&nbsp &nbsp &nbsp &nbsp <input type="radio" name="q_16_a" value="2" />b - I share the refrigerator with other people and someone else is responsible for it <br>
&nbsp &nbsp &nbsp &nbsp <input type="radio" name="q_16_a" value="3" />c - Other reason <br>
&nbsp &nbsp &nbsp &nbsp <i>(If other reason please specify) </i> : <input name="q_16_b" value="" onclick="show103();" /><br>
</p>
</div> <br>
<input type="radio" name="q_16" value="2" onclick="show101();" />2 - Rarely <br>
<input type="radio" name="q_16" value="3" onclick="show101();" />3 - Often <br>
<input type="radio" name="q_16" value="4" onclick="show101();" />4 - Always <br>
<br> <br>
<p>
<b>17) Suppose you are about to book a taxi (e.g. UBER) to Orly airport.
<br> Which option would you choose?
</b>
{% formfield player.q_17 %}
</p>
<p>
<b>18) Electric cars are less polluting than petrol or diesel cars.</b>
<br> <i><b> (Indicate your degree of agreement)</b></i>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_18 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>19) Would you be interested in buying an alternative fuel car?</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_19_p2 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>20) Do you adopt eco-responsible driving? </b>
<br>
<i>
Eco-responsible driving consists of: Checking the tire pressure.
Make sure the vehicle is in good condition. Adopt a smooth driving
(Start smoothly and change without waiting for a higher gear to
avoid over-revs). Stop the engine during a prolonged stop. Do not
abuse the air conditioning.
</i>
{% formfield player.q_20 %}
</p>
<p>{% next_button %}</p>
</div></div>
</div></div>
{% endblock %}
{% block scripts %}
<script>
function show101(){
document.getElementById('div10').style.display ='none';
}
function show102(){
document.getElementById('div10').style.display = 'block';
}
function show103(){
document.getElementById('div10').style.display ='none';
}
</script>
{% endblock %}

View File

@ -0,0 +1,338 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Questionnaire (3/3)
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
The answers to the following questions will not be taken into account when calculating your winnings.
However, we ask that you answer as honestly as possible. As a reminder, all your answers will
be treated anonymously, and no one will have access to your answers.
<br><br>
<div class="card bg-light m-3">
<div class="card-body">
<p>
<b>21)
Support higher taxes for environmentally damaging behavior.
<br><i>(Indicate your degree of agreement) </i>
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_21 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>22)
In a political program, the place given to environmental issues influences my vote.
<br><i>(Indicate your degree of agreement) </i>
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_22_n %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>23) Do you often discuss environmental issues with friends? </b>
{% formfield player.q_23 %}
</p>
<p><b> 24) Are you a member of an environmental organisation? If so, which one? </b>? </p>
<input type="radio" name="q_24" value="0" onclick="show101();" />No <br>
<input type="radio" name="q_24" value="1" onclick="show102();" />Yes <div id="div10" class="hide">
<hr>
<p>{% formfield player.q_24_a %}
</p>
</div>
<br><br>
<p>
<b>25) Do you support financial incentives for environmentally beneficial technology? </b>
<br><i>(Indicate your degree of agreement) </i>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_25 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b> 26) For each of the following actions, please indicate whether it can reduce the
individual carbon footprint to a small or very large extent: </b>
</b>
</p>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<th colspan=3>a. Avoid air travel. Reduced way: </th>
</tr>
<tr>
<td>Not very important </td>
<td> {% formfield player.q_26_a %} </td>
<td> Very important </td>
</tr>
<tr>
<th colspan=3>b. Have fewer children. Reduced way: </th>
</tr>
<tr>
<td>Not very important</td>
<td> {% formfield player.q_26_b %} </td>
<td> Very important </td>
</tr>
<tr>
<th colspan=3>c. Not having a car. Reduced way: </th>
</tr>
<td>Not very important</td>
<td> {% formfield player.q_26_c %} </td>
<td> Very important </td>
</tr>
<tr>
<th colspan=3>d. a Vegetarian diet. Reduced way: </th>
</tr>
<tr>
<td>Not very important</td>
<td> {% formfield player.q_26_d %} </td>
<td> Very important </td>
</tr>
</table>
</p>
<p>
</p>
<p>
<b>27) For each of these actions, please indicate whether you would be prepared to adopt it: </b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<th colspan=3>a- Avoid air travel: </th>
</tr>
<tr>
<td> Not prepared at all </td>
<td> {% formfield player.q_27_a %} </td>
<td> Very prepared</td>
</tr>
<tr>
<th colspan=3>b- Have fewer children: </th>
</tr>
<tr>
<td> Not prepared at all </td>
<td> {% formfield player.q_27_b %} </td>
<td> Very prepared</td>
</tr>
<tr>
<th colspan=3>c- Not owning a car: </th>
</tr>
<td> Not prepared at all </td>
<td> {% formfield player.q_27_c %} </td>
<td> Very prepared</td>
</tr>
<tr>
<th colspan=3>d- Adopt a vegetarian diet: </th>
</tr>
<tr>
<td> Not prepared at all </td>
<td> {% formfield player.q_27_d %} </td>
<td> Very prepared</td>
</tr>
</table>
</p>
<p>
<b>28) For each of the following questions, please indicate whether it concerns you: </b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<th colspan=3>a- Global warming: </th>>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_a %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>b- Air pollution: </th>>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_b %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>c- The disappearance of animal and plant species: </th>
</tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_c %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>d- The abundance of non-recyclable waste: </th>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_d %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>e- The use of pesticides: </th>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_e %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>f- Depletion of resources (drinking water, fossil fuels): </th>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_f %} </td>
<td> Very concerned</td>
</tr>
</table>
</p>
<p>
<b>29) Rank the consumption items (for a household) from the highest CO2 emissions to the lowest.
<br> <i> (1: highest CO2 emissions; ...; 4: lowest CO2 emissions)</i>
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<th colspan=3>a- Transport:
<br>
<select name="q_29_a" id="a">
<option value="">--Please choose an rank--</option>
<option value="1">1 - Highest CO2 emissions</option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 - Lowest CO2 emissions</option>
</select>
</th>
</tr>
<tr>
<th colspan=3>b- Food:
<br>
<select name="q_29_b" id="b">
<option value="">--Please choose an rank--</option>
<option value="1">1 - Highest CO2 emissions</option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 - Lowest CO2 emissions</option>
</select>
</th>
</tr>
<tr>
<th colspan=3>c- Energy consumption in the home (heating, lighting):
<br>
<select name="q_29_c" id="c">
<option value="">--Please choose an rank--</option>
<option value="1">1 - Highest CO2 emissions</option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 - Lowest CO2 emissions</option>
</select>
</th>
</tr>
<tr>
<th colspan=3>d- Energy consumption of various equipment
(appliances installed and used in the home or elsewhere):
<br>
<select name="q_29_d" id="d">
<option value="">--Please choose an rank--</option>
<option value="1">1 - Highest CO2 emissions</option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 - Lowest CO2 emissions</option>
</select>
</th>
</tr>
</table>
</p>
<p>
<b>
30) Did you know that you currently live in a green building (with low energy consumption)?
</b>
{% formfield player.q_30 %}
</p>
{% formfield player.q_31 %}
<p>{% next_button %}</p>
</div></div>
</div></div>
{% endblock %}
{% block scripts %}
<script>
function show101(){
document.getElementById('div10').style.display ='none';
}
function show102(){
document.getElementById('div10').style.display = 'block';
}
</script>
{% endblock %}

View File

@ -0,0 +1,29 @@
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
First part : End
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
You have completed the first part.
<br> You will now begin the second part.
</p>
</div>
</div>
<p>{% next_button %}</p>
{% endblock %}

83
a1_en_p1_quest/tests.py Normal file
View File

@ -0,0 +1,83 @@
from otree.api import Currency as c, currency_range, Submission
from . import pages
from ._builtin import Bot
from .models import Constants
import random
# **********************************************************************************************************************
# *** BOT
# **********************************************************************************************************************
class PlayerBot(Bot):
def play_round(self):
if self.participant.vars['questionnaire_before'] == 1:
yield (pages.Bienvenue)
yield (pages.Questionnaire0, {
'q_1': 1,
'q_2_a': 1,
'q_2_b': 1,
'q_2_c': 1,
'q_22': 1,
'q_2_e_a': 1,
'q_2_e_b': 1,
'q_2_e_c': 1,
'q_2_h': 1,
'q_3': 1,
'q_4': 1,
'q_5': 1,
'q_6': 1,
'q_7': 1,
'q_8': 1,
'q_9': 1,
'q_10': 1,
'q_11': 1,
})
yield (pages.Questionnaire1, {
'q_12': 1,
'q_13': 1,
'q_14': 1,
'q_15': 1,
# 'q_16': 1,
# 'q_17': 1,
# 'q_18': 1,
'q_16': 1,
'q_16_a': 1,
'q_16_b': 1,
'q_17': 1,
'q_18': 1,
'q_19_p2': 1,
'q_20': 1,
})
yield (pages.Questionnaire2, {
'q_21':1,
'q_22_n':1,
'q_23':1,
'q_24':1,
'q_24_a':1,
'q_25':1,
'q_26_a':1,
'q_26_b':1,
'q_26_c':1,
'q_26_d':1,
'q_27_a':1,
'q_27_b':1,
'q_27_c':1,
'q_27_d':1,
'q_28_a':1,
'q_28_b':1,
'q_28_c':1,
'q_28_d':1,
'q_28_e':1,
'q_28_f':1,
'q_29_a':1,
'q_29_b':1,
'q_29_c':1,
'q_29_d':1,
'q_30':1,
'q_31':"blabla",
})

View File

View File

@ -0,0 +1,20 @@
# Don't change anything in this file.
from .. import models
import otree.api
class Page(otree.api.Page):
subsession: models.Subsession
group: models.Group
player: models.Player
class WaitPage(otree.api.WaitPage):
subsession: models.Subsession
group: models.Group
class Bot(otree.api.Bot):
subsession: models.Subsession
group: models.Group
player: models.Player

797
a1_en_p1_quest_v2/models.py Normal file
View File

@ -0,0 +1,797 @@
from otree.api import (
models,
widgets,
BaseConstants,
BaseSubsession,
BaseGroup,
BasePlayer,
Currency as c,
currency_range,
)
doc = """
author = 'Wael Bousselmi'
Exp E4C
"""
class Constants(BaseConstants):
name_in_url = 'a1_en_p1_quest_v2'
players_per_group = None
num_rounds = 1
showupfee = 0
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,
))
return dict(report=report)
class Group(BaseGroup):
pass
class Player(BasePlayer):
def role(self):
return {1: 'A', 2: 'B'}[self.id_in_group]
treatment = models.IntegerField()
################################################ page Questionnaire 0
game_num = models.IntegerField()
app_sequence_select = models.IntegerField()
questionnaire_before = models.IntegerField()
language = models.StringField()
q_1 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_2_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_22 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_e_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_e_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_e_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_2_h = models.StringField(
label="",
blank=True
)
q_3 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_4 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_5 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
# q_6 = models.IntegerField(
# choices=[
# [1, '1'],
# [2, '2'],
# [3, '3'],
# [4, '4'],
# [5, '5'],
# [6, '6'],
# ],
# widget=widgets.RadioSelectHorizontal,
# label="",
# blank=False
# )
q_6 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
[5, '5 - I dont drink coffee (or the) at school/work'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_7 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_8 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_9 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_10 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
# q_11 = models.IntegerField(
# choices=[
# [1, '1 - Jamais'],
# [2, '2 - Rarement'],
# [3, '3 - Souvent'],
# [4, '4 - Toujours'],
# ],
# widget=widgets.RadioSelect,
# label="",
# blank=False
# )
q_11 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
[5, '5 - I dont use batteries'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
################################################ page Questionnaire 1
q_12 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_13 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_14 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_15 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
# q_16 = models.IntegerField(
# choices=[
# [1, '1 - Never'],
# [2, '2 - Rarely'],
# [3, '3 - Often'],
# [4, '4 - Always'],
# ],
# widget=widgets.RadioSelect,
# label="",
# blank=False
# )
#
# q_17 = models.IntegerField(
# choices=[
# [1, '1 - Never'],
# [2, '2 - Rarely'],
# [3, '3 - Often'],
# [4, '4 - Always'],
# ],
# widget=widgets.RadioSelect,
# label="",
# blank=False
# )
#
# q_18 = models.IntegerField(
# choices=[
# [1, '1 - Never'],
# [2, '2 - Rarely'],
# [3, '3 - Often'],
# [4, '4 - Always'],
# ],
# widget=widgets.RadioSelect,
# label="",
# blank=False
# )
q_16 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_16_a = models.IntegerField(
label="",
blank=True
)
q_16_b = models.StringField(
label="",
blank=True
)
q_17 = models.IntegerField(
choices=[
[1, 'a- Green (100% electric or hybrid) (€26 per ride)'],
[2, 'b- UberX (Economical, fast and reliable) (at €22 per ride) '],
[3, 'c- Comfort (spacious vehicles and top rated drivers) (at €30 per ride)'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_18 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_19_p2 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_20 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
[5, '5 - I dont drive'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
################################################# Page : Questionnaire2
q_21 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_22_n = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_23 = models.IntegerField(
choices=[
[1, '1 - Never'],
[2, '2 - Rarely'],
[3, '3 - Often'],
[4, '4 - Always'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_24 = models.IntegerField(
choices=[
[0, 'Oui'],
[1, 'Non'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_24_a = models.StringField(
label="If yes which one? ",
blank=True
)
q_25 = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_26_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
[7, '7'],
[8, '8'],
[9, '9'],
[10, '10'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_26_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
[7, '7'],
[8, '8'],
[9, '9'],
[10, '10'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_26_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
[7, '7'],
[8, '8'],
[9, '9'],
[10, '10'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_26_d = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
[7, '7'],
[8, '8'],
[9, '9'],
[10, '10'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
# ------------- à modifier ici !!!!!!
q_27_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_27_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_27_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_27_d = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_a = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_b = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_c = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_d = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_e = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_28_f = models.IntegerField(
choices=[
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
[5, '5'],
[6, '6'],
],
widget=widgets.RadioSelectHorizontal,
label="",
blank=False
)
q_29_a = models.IntegerField(
label="",
blank=False
)
q_29_b = models.IntegerField(
label="",
blank=False
)
q_29_c = models.IntegerField(
label="",
blank=False
)
q_29_d = models.IntegerField(
label="",
blank=False
)
q_30 = models.IntegerField(
choices=[
[0, 'Yes'],
[1, 'No'],
],
widget=widgets.RadioSelect,
label="",
blank=False
)
q_31 = models.StringField(
label="31) What does this mean for you?",
)

View File

@ -0,0 +1,73 @@
from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants
import random
import time
class Bienvenue(Page):
form_model = 'player'
form_fields = []
def is_displayed(self):
return self.player.participant.vars['questionnaire_before'] == 0
def before_next_page(self):
self.player.game_num = self.player.participant.vars['game_num']
self.player.app_sequence_select = self.player.participant.vars['app_sequence_select']
self.player.questionnaire_before = self.player.participant.vars['questionnaire_before']
class Questionnaire0(Page):
form_model = 'player'
form_fields = ['q_1', 'q_2_a', 'q_2_b', 'q_2_c',
'q_22', 'q_2_e_a', 'q_2_e_b', 'q_2_e_c', 'q_2_h',
'q_3', 'q_4', 'q_5', 'q_6',
'q_7', 'q_8', 'q_9', 'q_10', 'q_11',
]
def is_displayed(self):
return self.player.participant.vars['questionnaire_before'] == 0
class Questionnaire1(Page):
form_model = 'player'
form_fields = [
'q_12', 'q_13', 'q_14', 'q_15',
'q_16',
'q_16_a','q_16_b', 'q_17',
'q_18',
'q_19_p2', 'q_20',
]
def is_displayed(self):
return self.player.participant.vars['questionnaire_before'] == 0
class Questionnaire2(Page):
form_model = 'player'
form_fields = [ 'q_21', 'q_22_n', 'q_23', 'q_24',
'q_24_a', 'q_25',
'q_26_a', 'q_26_b',
'q_26_c', 'q_26_d',
'q_27_a', 'q_27_b', 'q_27_c',
'q_27_d',
'q_28_a', 'q_28_b', 'q_28_c',
'q_28_d', 'q_28_e', 'q_28_f',
'q_29_a', 'q_29_b','q_29_c', 'q_29_d',
'q_30', 'q_31'
]
def is_displayed(self):
return self.player.participant.vars['questionnaire_before'] == 0
page_sequence = [
Bienvenue,
Questionnaire0,
Questionnaire1,
Questionnaire2,
]

View File

@ -0,0 +1,41 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
<h3>
Please click on the "Next" button to go to the next step
</h3>
</p>
<p>{% next_button %}</p>
</div></div>
{% endblock %}

View File

@ -0,0 +1,228 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Questionnaire (1/3)
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
The answers to the following questions will not be taken into account when calculating your winnings.
However, we ask that you answer as honestly as possible. As a reminder, all your answers will
be treated anonymously, and no one will have access to your answers.
<br><br>
<div class="card bg-light m-3">
<div class="card-body">
<p>
<b>1)
Do you buy organic and / or ecological products?
</b>
{% formfield player.q_1 %}
</p>
<br>
<p>
<b> 2) For each of the following criteria, please indicate if it can influence your choice to buy a product:
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td colspan=3><b>a. The price</b> can influence your choices of products to buy </td>
</tr>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_2_a %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3><b>b. The origin</b> can influence your choices of products to buy </td>
</tr>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_2_b %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3><b>c. The quality</b> can influence your choices of products to buy </td>
</tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_2_c %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3> <b>d. The taste (if it is a food product) </b> can influence your choices of products to buy </td>
</tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_22 %} </td>
<td> Strongly agree</td>
</tr>
<th colspan=3>e. Label influence: </th>
</tr>
<tr>
<td colspan=3>
&nbsp &nbsp &nbsp &nbsp &nbsp <b>* The organic label</b> can influence your choices of products to buy
<br> <b>* Organic label:</b>
<i> An organic product is a product from organic farming (it is an agricultural production
method that excludes the use of most synthetic chemicals, toxic products, etc.).
There is a label (AB) in France that authenticates products from this method of
agriculture. </i>
</td>
</tr>
<tr>
<td> &nbsp &nbsp &nbsp &nbsp Strongly disagree </td>
<td> {% formfield player.q_2_e_a %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3>
&nbsp &nbsp &nbsp &nbsp &nbsp <b>* The ecological label</b> can influence your choices of products to buy
<br> <b>* Ecological label:</b>
<i> An ecological product is a product that will be thought out, designed,
packaged, distributed, recycled in such a way as to minimize the impact on the environment.
It must comply with many rules related to these steps during specifications drawn up by
an organization such as ECOLABEL or ECOCERT.
An ecological product must be designed with maximum respect for the environment
(respect linked to the use of raw materials and machines during manufacture).
The life cycle of the product as well as its recycling are also important points
to consider. </i>
</td>
</tr>
<tr>
<td> &nbsp &nbsp &nbsp &nbsp Strongly disagree </td>
<td> {% formfield player.q_2_e_b %} </td>
<td> Strongly agree</td>
</tr>
<tr>
<td colspan=3>
&nbsp &nbsp &nbsp &nbsp &nbsp <b>* The equitable trade label</b> can influence your choices of products to buy
<br> <b>* Equitable trade label: </b>
<i> Equitable trade is a commercial and international partnership, based on concrete principles and launched
almost 20 years ago. Its objective is to be able to guarantee a better balance between
producers and resellers, by ensuring better working conditions and better remuneration
for small producers. </i>
</tr>
<tr>
<td> &nbsp &nbsp &nbsp &nbsp Strongly disagree </td>
<td> {% formfield player.q_2_e_c %} </td>
<td> Strongly agree</td>
</tr>
</table>
<p>
&nbsp &nbsp &nbsp &nbsp &nbsp *
<b>Other label can influence your choices of
products to buy </b>(if yes, to indicate)
{% formfield player.q_2_h %}
</p>
<p>
<b> 3) Do you shop online ? </b>
{% formfield player.q_3 %}
</p>
<p>
<b> 4) Do you shop clothes online? </b>
{% formfield player.q_4 %}
</p>
<p>
<b>5)
Do you agree that it is less
environmentally friendly to shop online rather than in-store?
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_5 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>6) Do you bring your own cup of coffee (tea) to school/work (instead of using the
cups from the coffee machine)? </b>
{% formfield player.q_6 %}
</p>
<p>
<b>7) Do you sort your household waste? </b>
{% formfield player.q_7 %}
</p>
<p>
<b> 8) Do you use a compost bin? </b>
{% formfield player.q_8 %}
</p>
<p>
<b>9) Do you collect and recycle used paper? </b>
{% formfield player.q_9 %}
</p>
<p>
<b>10) Do you reuse your shopping bags? </b>
{% formfield player.q_10 %}
</p>
<p>
<b>11) Do you return used batteries to appropriate recycling points? </b>
{% formfield player.q_11 %}
</p>
<p>{% next_button %}</p>
</div></div>
</div></div>
{% endblock %}
{% block scripts %}
<script>
function show101(){
document.getElementById('div10').style.display ='none';
}
function show102(){
document.getElementById('div10').style.display = 'block';
}
</script>
{% endblock %}

View File

@ -0,0 +1,150 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Questionnaire (2/3)
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
The answers to the following questions will not be taken into account when calculating your winnings.
However, we ask that you answer as honestly as possible. As a reminder, all your answers will
be treated anonymously, and no one will have access to your answers.
<p>
The questions in this section relate to your habits as a student, i.e. they do not refer to the facilities in your accommodation prior to building 103. On the other hand, the "you" refers to yourself, and not to all the residents of your flat if it is a shared flat.
</p>
<br><br>
<div class="card bg-light m-3">
<div class="card-body">
<p>
<b>12) When buying new electronic devices, do you make sure to buy the ones that use the least amount of energy? </b>
{% formfield player.q_12 %}
</p>
<p>
<b>13) Do you switch off or completely disconnect electrical devices when not in use (without using the
standby mode)? </b>
{% formfield player.q_13 %}
</p>
<p>
<b>14) Do you use a dryer for your clothes? </b>
{% formfield player.q_14 %}
</p>
<p>
<b>15) Do you wait until you have a full charge before doing your laundry? </b>
{% formfield player.q_15 %}
</p>
<p><b> 16) Do you regularly defrost the fridge? </b></p>
<input type="radio" name="q_16" value="1" onclick="show102();" />1 - Never <div id="div10" class="hide">
<hr>
<p> &nbsp &nbsp &nbsp &nbsp <input type="radio" name="q_16_a" value="1" />a - Because I bought a frost free fridge on purpose <br>
&nbsp &nbsp &nbsp &nbsp <input type="radio" name="q_16_a" value="2" />b - I share the refrigerator with other people and someone else is responsible for it <br>
&nbsp &nbsp &nbsp &nbsp <input type="radio" name="q_16_a" value="3" />c - Other reason <br>
&nbsp &nbsp &nbsp &nbsp <i>(If other reason please specify) </i> : <input name="q_16_b" value="" onclick="show103();" /><br>
</p>
</div> <br>
<input type="radio" name="q_16" value="2" onclick="show101();" />2 - Rarely <br>
<input type="radio" name="q_16" value="3" onclick="show101();" />3 - Often <br>
<input type="radio" name="q_16" value="4" onclick="show101();" />4 - Always <br>
<br> <br>
<p>
<b>17) Suppose you are about to book a taxi (e.g. UBER) to Orly airport.
<br> Which option would you choose?
</b>
{% formfield player.q_17 %}
</p>
<p>
<b>18) Electric cars are less polluting than petrol or diesel cars.</b>
<br> <i><b> (Indicate your degree of agreement)</b></i>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_18 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>19) Would you be interested in buying an alternative fuel car?</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_19_p2 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>20) Do you adopt eco-responsible driving? </b>
<br>
<i>
Eco-responsible driving consists of: Checking the tire pressure.
Make sure the vehicle is in good condition. Adopt a smooth driving
(Start smoothly and change without waiting for a higher gear to
avoid over-revs). Stop the engine during a prolonged stop. Do not
abuse the air conditioning.
</i>
{% formfield player.q_20 %}
</p>
<p>{% next_button %}</p>
</div></div>
</div></div>
{% endblock %}
{% block scripts %}
<script>
function show101(){
document.getElementById('div10').style.display ='none';
}
function show102(){
document.getElementById('div10').style.display = 'block';
}
function show103(){
document.getElementById('div10').style.display ='none';
}
</script>
{% endblock %}

View File

@ -0,0 +1,338 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Questionnaire (3/3)
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
The answers to the following questions will not be taken into account when calculating your winnings.
However, we ask that you answer as honestly as possible. As a reminder, all your answers will
be treated anonymously, and no one will have access to your answers.
<br><br>
<div class="card bg-light m-3">
<div class="card-body">
<p>
<b>21)
Support higher taxes for environmentally damaging behavior.
<br><i>(Indicate your degree of agreement) </i>
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_21 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>22)
In a political program, the place given to environmental issues influences my vote.
<br><i>(Indicate your degree of agreement) </i>
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_22_n %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b>23) Do you often discuss environmental issues with friends? </b>
{% formfield player.q_23 %}
</p>
<p><b> 24) Are you a member of an environmental organisation? If so, which one? </b>? </p>
<input type="radio" name="q_24" value="0" onclick="show101();" />No <br>
<input type="radio" name="q_24" value="1" onclick="show102();" />Yes <div id="div10" class="hide">
<hr>
<p>{% formfield player.q_24_a %}
</p>
</div>
<br><br>
<p>
<b>25) Do you support financial incentives for environmentally beneficial technology? </b>
<br><i>(Indicate your degree of agreement) </i>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<td> Strongly disagree </td>
<td> {% formfield player.q_25 %} </td>
<td> Strongly agree</td>
</tr>
</table>
</p>
<p>
<b> 26) For each of the following actions, please indicate whether it can reduce the
individual carbon footprint to a small or very large extent: </b>
</b>
</p>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<th colspan=3>a. Avoid air travel. Reduced way: </th>
</tr>
<tr>
<td>Not very important </td>
<td> {% formfield player.q_26_a %} </td>
<td> Very important </td>
</tr>
<tr>
<th colspan=3>b. Have fewer children. Reduced way: </th>
</tr>
<tr>
<td>Not very important</td>
<td> {% formfield player.q_26_b %} </td>
<td> Very important </td>
</tr>
<tr>
<th colspan=3>c. Not having a car. Reduced way: </th>
</tr>
<td>Not very important</td>
<td> {% formfield player.q_26_c %} </td>
<td> Very important </td>
</tr>
<tr>
<th colspan=3>d. a Vegetarian diet. Reduced way: </th>
</tr>
<tr>
<td>Not very important</td>
<td> {% formfield player.q_26_d %} </td>
<td> Very important </td>
</tr>
</table>
</p>
<p>
</p>
<p>
<b>27) For each of these actions, please indicate whether you would be prepared to adopt it: </b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<th colspan=3>a- Avoid air travel: </th>
</tr>
<tr>
<td> Not prepared at all </td>
<td> {% formfield player.q_27_a %} </td>
<td> Very prepared</td>
</tr>
<tr>
<th colspan=3>b- Have fewer children: </th>
</tr>
<tr>
<td> Not prepared at all </td>
<td> {% formfield player.q_27_b %} </td>
<td> Very prepared</td>
</tr>
<tr>
<th colspan=3>c- Not owning a car: </th>
</tr>
<td> Not prepared at all </td>
<td> {% formfield player.q_27_c %} </td>
<td> Very prepared</td>
</tr>
<tr>
<th colspan=3>d- Adopt a vegetarian diet: </th>
</tr>
<tr>
<td> Not prepared at all </td>
<td> {% formfield player.q_27_d %} </td>
<td> Very prepared</td>
</tr>
</table>
</p>
<p>
<b>28) For each of the following questions, please indicate whether it concerns you: </b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<th colspan=3>a- Global warming: </th>>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_a %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>b- Air pollution: </th>>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_b %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>c- The disappearance of animal and plant species: </th>
</tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_c %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>d- The abundance of non-recyclable waste: </th>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_d %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>e- The use of pesticides: </th>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_e %} </td>
<td> Very concerned</td>
</tr>
<tr>
<th colspan=3>f- Depletion of resources (drinking water, fossil fuels): </th>
</tr>
<tr>
<td> Not concerned at all </td>
<td> {% formfield player.q_28_f %} </td>
<td> Very concerned</td>
</tr>
</table>
</p>
<p>
<b>29) Rank the consumption items (for a household) from the highest CO2 emissions to the lowest.
<br> <i> (1: highest CO2 emissions; ...; 4: lowest CO2 emissions)</i>
</b>
<table class='table text-left' style='width: auto; margin: auto'>
<tr>
<th colspan=3>a- Transport:
<br>
<select name="q_29_a" id="a">
<option value="">--Please choose an rank--</option>
<option value="1">1 - Highest CO2 emissions</option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 - Lowest CO2 emissions</option>
</select>
</th>
</tr>
<tr>
<th colspan=3>b- Food:
<br>
<select name="q_29_b" id="b">
<option value="">--Please choose an rank--</option>
<option value="1">1 - Highest CO2 emissions</option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 - Lowest CO2 emissions</option>
</select>
</th>
</tr>
<tr>
<th colspan=3>c- Energy consumption in the home (heating, lighting):
<br>
<select name="q_29_c" id="c">
<option value="">--Please choose an rank--</option>
<option value="1">1 - Highest CO2 emissions</option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 - Lowest CO2 emissions</option>
</select>
</th>
</tr>
<tr>
<th colspan=3>d- Energy consumption of various equipment
(appliances installed and used in the home or elsewhere):
<br>
<select name="q_29_d" id="d">
<option value="">--Please choose an rank--</option>
<option value="1">1 - Highest CO2 emissions</option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 - Lowest CO2 emissions</option>
</select>
</th>
</tr>
</table>
</p>
<p>
<b>
30) Did you know that you currently live in a green building (with low energy consumption)?
</b>
{% formfield player.q_30 %}
</p>
{% formfield player.q_31 %}
<p>{% next_button %}</p>
</div></div>
</div></div>
{% endblock %}
{% block scripts %}
<script>
function show101(){
document.getElementById('div10').style.display ='none';
}
function show102(){
document.getElementById('div10').style.display = 'block';
}
</script>
{% endblock %}

View File

@ -0,0 +1,29 @@
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
First part : End
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
You have completed the first part.
<br> You will now begin the second part.
</p>
</div>
</div>
<p>{% next_button %}</p>
{% endblock %}

View File

@ -0,0 +1,83 @@
from otree.api import Currency as c, currency_range, Submission
from . import pages
from ._builtin import Bot
from .models import Constants
import random
# **********************************************************************************************************************
# *** BOT
# **********************************************************************************************************************
class PlayerBot(Bot):
def play_round(self):
if self.participant.vars['questionnaire_before'] == 0:
yield (pages.Bienvenue)
yield (pages.Questionnaire0, {
'q_1': 1,
'q_2_a': 1,
'q_2_b': 1,
'q_2_c': 1,
'q_22': 1,
'q_2_e_a': 1,
'q_2_e_b': 1,
'q_2_e_c': 1,
'q_2_h': 1,
'q_3': 1,
'q_4': 1,
'q_5': 1,
'q_6': 1,
'q_7': 1,
'q_8': 1,
'q_9': 1,
'q_10': 1,
'q_11': 1,
})
yield (pages.Questionnaire1, {
'q_12': 1,
'q_13': 1,
'q_14': 1,
'q_15': 1,
# 'q_16': 1,
# 'q_17': 1,
# 'q_18': 1,
'q_16': 1,
'q_16_a': 1,
'q_16_b': 1,
'q_17': 1,
'q_18': 1,
'q_19_p2': 1,
'q_20': 1,
})
yield (pages.Questionnaire2, {
'q_21':1,
'q_22_n':1,
'q_23':1,
'q_24':1,
'q_24_a':1,
'q_25':1,
'q_26_a':1,
'q_26_b':1,
'q_26_c':1,
'q_26_d':1,
'q_27_a':1,
'q_27_b':1,
'q_27_c':1,
'q_27_d':1,
'q_28_a':1,
'q_28_b':1,
'q_28_c':1,
'q_28_d':1,
'q_28_e':1,
'q_28_f':1,
'q_29_a':1,
'q_29_b':1,
'q_29_c':1,
'q_29_d':1,
'q_30':1,
'q_31':"blabla",
})

0
a3_gp/__init__.py Normal file
View File

View File

@ -0,0 +1,20 @@
# Don't change anything in this file.
from .. import models
import otree.api
class Page(otree.api.Page):
subsession: models.Subsession
group: models.Group
player: models.Player
class WaitPage(otree.api.WaitPage):
subsession: models.Subsession
group: models.Group
class Bot(otree.api.Bot):
subsession: models.Subsession
group: models.Group
player: models.Player

116
a3_gp/models.py Normal file
View File

@ -0,0 +1,116 @@
from otree.api import (
models,
widgets,
BaseConstants,
BaseSubsession,
BaseGroup,
BasePlayer,
Currency as c,
currency_range,
)
doc = """
author = 'Wael Bousselmi'
Exp E4C
"""
class Constants(BaseConstants):
name_in_url = 'a3_gp'
players_per_group = None
num_rounds = 1
showupfee = 0
instructions_GP_template = 'a3_gp/instructions.html'
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,
))
return dict(report=report)
class Group(BaseGroup):
pass
class Player(BasePlayer):
# def role(self):
# return {1: 'A', 2: 'B'}[self.id_in_group]
game_num = models.IntegerField()
app_sequence_select = models.IntegerField()
app_sequence_select_n = models.StringField()
questionnaire_before = models.IntegerField()
treatment = models.IntegerField()
risk11_qc_a = models.IntegerField(
choices=[
[1, '3'],
[2, '4'],
[3, '5'],
[4, '6'],
[5, '7'],
],
widget=widgets.RadioSelectHorizontal,
blank=False
)
risk11_qc_b = models.IntegerField(
choices=[
[1, '4'],
[2, '6'],
[3, '16'],
[4, '22'],
[5, '28'],
],
widget=widgets.RadioSelectHorizontal,
blank=False
)
risk11_qc_c = models.IntegerField(
choices=[
[1, '4'],
[2, '6'],
[3, '16'],
[4, '22'],
[5, '28'],
],
widget=widgets.RadioSelectHorizontal,
blank=False
)
##########################################################################################
risk11_a = models.IntegerField(
label="investment dans le projet risqué",
blank=False,
min=0,
max=10
)
risk11_b = models.IntegerField(
label="investment dans le projet non-risqué",
blank=False,
min=0,
max=10
)
tiragerisk = models.FloatField()
gainrisk = models.FloatField()
tirageriskresult = models.StringField()
task_start_19 = models.FloatField()
task_time_19 = models.FloatField()
task_start_20 = models.FloatField()
task_time_20 = models.FloatField()

100
a3_gp/pages.py Normal file
View File

@ -0,0 +1,100 @@
from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants
import random
import time
class Bienvenue(Page):
form_model = 'player'
form_fields = []
# def is_displayed(self):
# return self.participant.vars['versionexp'] == 2
def is_displayed(self):
return self.round_number == 1
def before_next_page(self):
self.player.game_num = self.player.participant.vars['game_num'] + 1
self.player.participant.vars['game_num'] = self.player.game_num
self.player.app_sequence_select = self.player.participant.vars['app_sequence_select']
self.player.app_sequence_select_n =self.player.participant.vars['app_sequence_select_n']
self.player.questionnaire_before = self.player.participant.vars['questionnaire_before']
########################################################################################### Jeu 5 : Risk - Gneezy Potters- Questionnaire compréhension
class L_risk11_qc(Page):
form_model = 'player'
form_fields = ['risk11_qc_a', 'risk11_qc_b', 'risk11_qc_c']
# def is_displayed(self):
# return self.player.id_in_group % 2 == 1 and self.participant.vars['versionexp'] == 2
#
def vars_for_template(self):
self.player.task_start_19 = round(time.time(),2) ###### get_time
return {
'page': self.subsession.round_number + 10,
}
def error_message(self, values):
print('values is', values)
if values['risk11_qc_a'] != 2:
return 'Please correct your answer 1 !!'
elif values['risk11_qc_b'] != 4:
return 'Please correct your answer 2 !!'
elif values['risk11_qc_c'] != 1:
return 'Please correct your answer 3 !!'
def before_next_page(self):
self.player.task_time_19 = round(time.time() - self.player.task_start_19,2) ######### count_time
#self.player.treatment = self.player.participant.vars['treatment']
class M_risk11(Page):
# timeout_seconds = 1 # WB
form_model = 'player'
form_fields = ['risk11_a', 'risk11_b']
# def is_displayed(self):
# return self.player.id_in_group % 2 == 1 and self.participant.vars['versionexp'] == 2
def vars_for_template(self):
self.player.task_start_20 = round(time.time(),2) ###### get_time
return {
'page': self.subsession.round_number + 11,
}
def error_message(self, values):
print('values is', values)
if values['risk11_a'] + values['risk11_b'] != 10:
return 'The sum must be equal to 10 !!'
def before_next_page(self):
self.player.task_time_20 = round(time.time() - self.player.task_start_20,2) ######### count_time
self.player.tiragerisk = round(random.random(), 2) ##
if self.player.tiragerisk < 0.5:
self.player.gainrisk = (self.player.risk11_a * 3) + self.player.risk11_b
self.player.tirageriskresult = "Succès"
else:
self.player.gainrisk = self.player.risk11_b
self.player.tirageriskresult = "Echec"
self.participant.vars['tirageriskresult_j1'] = self.player.tirageriskresult
self.participant.vars['risk11_a_j1'] = self.player.risk11_a
self.participant.vars['risk11_b_j1'] = self.player.risk11_b
self.participant.vars['gainrisk_j1'] = self.player.gainrisk
page_sequence = [
Bienvenue,
L_risk11_qc,
M_risk11,
]

View File

@ -0,0 +1,41 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
<h3>
Please click on the "Next" button to go to the next step
</h3>
</p>
<p>{% next_button %}</p>
</div></div>
{% endblock %}

View File

@ -0,0 +1,28 @@
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Second part: End
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
You have completed the second part.
<br> You will now begin the third part.
</p>
</div>
</div>
<p>{% next_button %}</p>
{% endblock %}

View File

@ -0,0 +1,75 @@
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Game {{player.game_num}}
{% endblock %}
{% block content %}
<p> <b>
This game can be taken into account when calculating your winnings.
</b></p>
{% include Constants.instructions_GP_template %}
<div class="card bg-light m-3">
<div class="card-body">
<br> <br>
<h3> Comprehension test: </h3>
<p> If you have invested 6 ECUs in the risky project: </p>
<p> 1) How many ECUs have you kept? </p>
<p> {% formfield player.risk11_qc_a label = ""%}
</p>
<p> 2) If the investment is successful, how many ECUs in your possession at the end of this game? </p>
<p> {% formfield player.risk11_qc_b label = ""%}
</p>
<p> 3) If the investment is unsuccessful, how many ECUs in your possession at the end of this game? </p>
<p> {% formfield player.risk11_qc_c label = ""%}
</p>
<br><br>
{% next_button %}
</div>
</div>
{% endblock %}
{% block scripts %}
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script>
function validateValue() {
risk11_qc_a = parseFloat(document.getElementById('risk11_qc_a').value),
risk11_qc_b = parseFloat(document.getElementById('risk11_qc_b').value),
risk11_qc_c = parseFloat(document.getElementById('risk11_qc_c').value);
if (risk11_qc_a >1) {
window.alert("wwwwwwwwww");
document.getElementById('risk11_qc_a').value = "";
}
}
</script>
{% endblock %}

View File

@ -0,0 +1,55 @@
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Game {{player.game_num}}
{% endblock %}
{% block content %}
<div class="card bg-light instructions">
<div class="card-body">
<br><br>
<h3>
Votre choix :
</h3>
<div class="card bg-light m-3">
<div class="card-body">
<br>
<p> Please enter the amount of your investment in the project (in ECUs) (an amount between 0 and 10): </p>
<p> {% formfield player.risk11_a label = ""%}
</p>
<p> So, how many ECUs did you keep (an amount between 0 and 10)? </p>
<p> {% formfield player.risk11_b label = ""%}
</p>
<p>
Note: the sum of the two amounts must be equal to 10.
</p>
<br> <br>
{% next_button %}
</div>
</div>
<br> <br>
<div class="card bg-light instructions">
<div class="card-body">
{% include Constants.instructions_GP_template %}
</div></div>
{% endblock %}

View File

@ -0,0 +1,43 @@
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
{% endblock %}
{% block content %}
<div class="card bg-light instructions">
<div class="card-body">
<h3> Jeu 1 : RESULTAT </h3>
<p> Le tirage au sort est : {{player.tirageriskresult}}
</p>
<p> Votre investissement dans lactif risqué : {{player.risk11_a}}</p>
<p> Vous avez gardé : {{player.risk11_b}}</p>
<br>
<p> Votre gain pour ce jeu est de : {{player.gainrisk}} ECU(s)</p>
<br><br>
</div>
</div>
<br> <br>
<h3>
Rappel des instructions :
</h3>
<div class="card bg-light instructions">
<div class="card-body">
{% include Constants.instructions_GP_template %}
</div></div>
{% endblock %}

View File

@ -0,0 +1,45 @@
{% load otree %}
<div class="card bg-light m-3">
<div class="card-body">
<h3>
Rules of the game :
</h3>
<p> You have a capital of 10 ECUs, and you must decide the amount of your investment in the project described below.
You can invest any amount between 0 ECUs and 10 ECUs (in whole numbers). </p>
<h5> Project description: </h5>
<p> This project earns <b> 3 times </b> the amount invested in the event of success and 0 in the event of failure.
Success and failure have the same probability of happening: 1 in 2 chance. </p>
<br>
<p> <center> <b> Your gain from this task = amount retained + gain from your investment in the project. </b></center> </p>
<br>
<p> <b> Example 1: </b> You decide to invest 4 ECUs in the project. The project is a success. Your project gain is
of 3 x 4 ECUs = 12 ECUs. Your gain from this task is therefore 6 ECUs kept + 12 ECUs from the project = 18 ECUs.
</p>
<p> <b> Example 2: </b> You decide to invest 4 ECUs in the project. The project is a failure. Your project gain is
of 0 x 4 ECUs = 0 ECUs. Your gain from this game is therefore 6 ECUs kept + 0 ECUs from the project = 6 ECUs.
</p>
<p><b><center>The exchange rate for this game is (1 ECU = 0.8 EUROS) </center></b></p>
<br>
</div> </div>
<div class="card bg-light m-3">
<div class="card-body">
<p>
<h3> Summary of the game: </h3>
<center> <img src="{% static 'e4c/gneezy_potters_en.png'%}" width="70%" height="100%" alt=""/>
</center>
</p>
</div>
</div>

33
a3_gp/tests.py Normal file
View File

@ -0,0 +1,33 @@
from otree.api import Currency as c, currency_range, Submission
from . import pages
from ._builtin import Bot
from .models import Constants
import random
# **********************************************************************************************************************
# *** BOT
# **********************************************************************************************************************
class PlayerBot(Bot):
def play_round(self):
yield (pages.Bienvenue)
# if self.player.id_in_group % 2 == 1 and self.participant.vars['versionexp'] == 2:
yield (pages.L_risk11_qc, {
'risk11_qc_a': 2,
'risk11_qc_b': 4,
'risk11_qc_c': 1,
})
yield (pages.M_risk11, {
'risk11_a': 0, #random.randint(0, 10),
'risk11_b': 10 ,
})

0
a3_welcome/__init__.py Normal file
View File

View File

@ -0,0 +1,20 @@
# Don't change anything in this file.
from .. import models
import otree.api
class Page(otree.api.Page):
subsession: models.Subsession
group: models.Group
player: models.Player
class WaitPage(otree.api.WaitPage):
subsession: models.Subsession
group: models.Group
class Bot(otree.api.Bot):
subsession: models.Subsession
group: models.Group
player: models.Player

42
a3_welcome/models.py Normal file
View File

@ -0,0 +1,42 @@
from otree.api import (
models,
widgets,
BaseConstants,
BaseSubsession,
BaseGroup,
BasePlayer,
Currency as c,
currency_range,
)
doc = """
author = 'Wael Bousselmi'
Exp E4C
"""
class Constants(BaseConstants):
name_in_url = 'a3_welcome'
players_per_group = None
num_rounds = 1
class Subsession(BaseSubsession):
pass
class Group(BaseGroup):
pass
class Player(BasePlayer):
game_num = models.IntegerField(initial=0)
app_sequence_select = models.IntegerField(initial=1)
app_sequence_select_n = models.StringField()
questionnaire_before = models.IntegerField(initial=0)

31
a3_welcome/pages.py Normal file
View File

@ -0,0 +1,31 @@
from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants
import random
import time
class BienvenueBis(Page): # version anglaise
form_model = 'player'
form_fields = []
def before_next_page(self):
self.player.game_num = 0
self.player.app_sequence_select = random.randint(1,4)
self.player.questionnaire_before = random.randint(0,1)
self.player.participant.vars['game_num'] = self.player.game_num
self.player.participant.vars['app_sequence_select'] = self.player.app_sequence_select
self.player.participant.vars['questionnaire_before'] = self.player.questionnaire_before
if self.player.app_sequence_select == 1:
self.player.app_sequence_select_n = "gp;bw;MDG_asso;MDG_class"
elif self.player.app_sequence_select == 2:
self.player.app_sequence_select_n = "gp;bw;MDG_class;MDG_asso"
elif self.player.app_sequence_select == 3:
self.player.app_sequence_select_n = "bw;gp;MDG_asso;MDG_class"
elif self.player.app_sequence_select == 4:
self.player.app_sequence_select_n = "bw;gp;MDG_class;MDG_asso"
self.player.participant.vars['app_sequence_select_n'] = self.player.app_sequence_select_n
page_sequence = [
BienvenueBis,
]

View File

@ -0,0 +1,68 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Expérience en économie
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<h3>Bienvenue </h3>
<p>
Merci davoir accepté de participer à cette expérience.
Une rémunération fixe (de 5 €) vous sera versée
pour votre participation, et ce, quelles que soient vos réponses durant
cette expérience. À cela sajoutera <b>une rémunération variable</b> liée
à vos réponses au cours
de lexpérience.
</p>
<p>
Lexpérience dure environ 30 min. Elle se compose de <b>deux types de tâches</b> :
les questionnaires et les jeux.
La rémunération variable que vous percevrez à la fin de lexpérience
ne dépendra pas de vos réponses
aux questionnaires.
En effet, dans ces questionnaires, il ny a ni bonne, ni mauvaise réponse.
En revanche, votre rémunération
variable dépendra
de la qualité de vos réponses aux jeux. Plus précisément, <b>à la fin de lexpérience,
un seul des jeux
sera sélectionné
aléatoirement pour être payé pour de bon. </b>
</p>
<br>La monnaie utilisée dans cette expérience est l'ECU.
<br> <center> <b>Taux de change 1 ECU = {{ Constants.tauxchange}} €. </b></center>
<br>
<b> Important : Toutes vos réponses seront traitées anonymement.
Personne naura la possibilité didentifier directement vos décisions.</b>
<p>{% next_button %}</p>
</div></div>
{% endblock %}

View File

@ -0,0 +1,41 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Expérience en économie / Experiment in economics
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
<h3>Choix de la langue / Choice of language</h3>
{% formfield player.versionexp %}
</p>
<p>{% next_button %}</p>
</div></div>
{% endblock %}

View File

@ -0,0 +1,55 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
Experiment in economics
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<h3>Welcome </h3>
<p>Thank you for agreeing to participate in this experiment.
You will receive a fixed payment (of 5 €) for your participation,
regardless of your responses during this experiment. In addition, there will be a variable payment based on your responses during the experiment.
The experiment consists of two types of tasks: questionnaires and games.
</p>
<p>
These two tasks are independent of each other, and you will receive instructions at the beginning of each task.
The variable payment you will receive at the end of the experiment will not depend on your responses to the questionnaires. In fact, in these questionnaires, there are no right or wrong answers. However, your variable payment will depend on the quality of your responses to the games.
Specifically, at the end of the experiment, only one of the games will be randomly selected to be paid for real.
The currency used in this experiment is the ECU.
</p>
<p>
In case of non-integer winnings, the amount will be rounded (winnings of 1.4 → final winnings of 1€, winnings of 2.8 → final winnings of 3€).
</p>
<p>
The experiment lasts about 45 minutes, probably less. You are free to leave the experiment at any time, but if you decide to leave the experiment before completing it, you will not be paid.
</p>
<br>
<b>Important: All your answers will be treated anonymously. No one will be able to directly identify your decisions.
</b>
<p>{% next_button %}</p>
</div></div>
{% endblock %}

23
a3_welcome/tests.py Normal file
View File

@ -0,0 +1,23 @@
from otree.api import Currency as c, currency_range, Submission
from . import pages
from ._builtin import Bot
from .models import Constants
import random
# **********************************************************************************************************************
# *** BOT
# **********************************************************************************************************************
class PlayerBot(Bot):
def play_round(self):
# yield (pages.Bienvenue0, {
# 'versionexp': random.randint(1,2),
# })
#
# if self.participant.vars['versionexp'] == 1:
# yield (pages.Bienvenue)
# elif self.participant.vars['versionexp'] == 2:
yield (pages.BienvenueBis)

0
a5_questfin/__init__.py Normal file
View File

View File

@ -0,0 +1,20 @@
# Don't change anything in this file.
from .. import models
import otree.api
class Page(otree.api.Page):
subsession: models.Subsession
group: models.Group
player: models.Player
class WaitPage(otree.api.WaitPage):
subsession: models.Subsession
group: models.Group
class Bot(otree.api.Bot):
subsession: models.Subsession
group: models.Group
player: models.Player

646
a5_questfin/models.py Normal file
View File

@ -0,0 +1,646 @@
from otree.api import (
models,
widgets,
BaseConstants,
BaseSubsession,
BaseGroup,
BasePlayer,
Currency as c,
currency_range,
)
doc = """
author = 'Wael Bousselmi'
Exp E4C
"""
class Constants(BaseConstants):
name_in_url = 'a5_questfin'
players_per_group = None
num_rounds = 1
app_seq1 = ["gp", "bw", "MDG_asso", "MDG_class"]
app_seq2 = ["gp", "bw", "MDG_class", "MDG_asso"]
app_seq3 = ["bw", "gp", "MDG_asso", "MDG_class"]
app_seq4 = ["bw", "gp", "MDG_class", "MDG_asso"]
exchangerate_gp_bw = 0.8
exchangerate_DGM = 0.1
showupfee = 5
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,
game_select_n = p.game_select_n,
gainrisk_eur = p.gainrisk_eur,
gain_bw_eur = p.gain_bw_eur,
mdgasso_gain_dgm_eur = p.mdgasso_gain_dgm_eur,
mdgasso_gain_asso_eur = p.mdgasso_gain_asso_eur,
mdgclass_gain_dgm_eur = p.mdgclass_gain_dgm_eur,
mdgclass_dgm_selected = p.mdgclass_dgm_selected,
mdgclass_round_selected = p.mdgclass_round_selected,
mdgclass_dot1_select = p.mdgclass_dot1_select,
mdgclass_s1_select = p.mdgclass_s1_select,
mdgclass_g1_select = p.mdgclass_g1_select,
mdgclass_keep_select = p.mdgclass_keep_select,
mdgclass_sent_select = p.mdgclass_sent_select,
mdgclass_gain_joueur2 = p.mdgclass_gain_joueur2,
mdgclass_gain_joueur2_eur = p.mdgclass_gain_joueur2_eur,
dictatorYES = p.dictatorYES,
app_sequence_select_n = p.app_sequence_select_n,
game_num_select = p.game_num_select,
firstname = p.firstname,
lastname = p.lastname,
email = p.email,
room = p.room,
gainfinal_eur_f = p.gainfinal_eur_f,
gainfinal_eur_showupfee_f = p.gainfinal_eur_showupfee_f,
gainfinal_asso_eur_f = p.gainfinal_asso_eur_f
))
return dict(report=report)
class Group(BaseGroup):
pass
class Player(BasePlayer):
app_sequence_select = models.IntegerField()
app_sequence_select_n = models.StringField()
questionnaire_before = models.IntegerField()
game_num_select = models.IntegerField()
game_select_n = models.StringField()
game_select = models.IntegerField()
# result of GP
tirageriskresult = models.StringField()
tirageriskresult_en = models.StringField()
risk11_a = models.FloatField()
risk11_b = models.FloatField()
gainrisk = models.FloatField()
gainrisk_eur = models.FloatField()
# result of BW
tirage_color_n = models.StringField()
gain_bw = models.FloatField()
gain_bw_eur = models.FloatField()
# result of MDG_asso
mdgasso_dgm_selected = models.IntegerField()
mdgasso_round_selected = models.IntegerField()
mdgasso_dot1_select = models.IntegerField()
mdgasso_s1_select = models.IntegerField()
mdgasso_g1_select = models.IntegerField()
mdgasso_keep_select = models.FloatField()
mdgasso_sent_select = models.FloatField()
mdgasso_gain_dgm = models.FloatField()
mdgasso_gain_asso = models.FloatField()
mdgasso_gain_dgm_eur = models.FloatField()
mdgasso_gain_asso_eur = models.FloatField()
# result of MDG_classique
mdgclass_dgm_selected = models.IntegerField()
mdgclass_round_selected = models.IntegerField()
mdgclass_dot1_select = models.IntegerField()
mdgclass_s1_select = models.IntegerField()
mdgclass_g1_select = models.IntegerField()
mdgclass_keep_select = models.FloatField()
mdgclass_sent_select = models.FloatField()
mdgclass_gain_dgm = models.FloatField()
mdgclass_gain_joueur2 = models.FloatField()
mdgclass_gain_dgm_eur = models.FloatField()
mdgclass_gain_joueur2_eur = models.FloatField()
dictatorYES = models.IntegerField()
dictatorYES_n = models.StringField()
# demographic quetsionnaire
q_40_etude = models.IntegerField(
choices=[
[1, '1- Arts and / or literature'],
[2, '2- Economy and / or management'],
[3, '3- Scientific / engineering'],
[4, '4- Other'],
],
widget=widgets.RadioSelect,
label="a. Your field of study ",
blank=False
)
q_41_gender = models.IntegerField(
choices=[
[1, '1- Woman'],
[2, '2- Male'],
[3, '3- Non-binary'],
[4, '4- Do not wish to answer'],
],
widget=widgets.RadioSelect,
label="b. You are ",
blank=False
)
q_42_age = models.IntegerField(
label="c. How old are you?",
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. Country of citizenship",
)
q_44_revenu = models.IntegerField(
choices=[
[1, '1- Less than 5,000 Euros'],
[2, '2- Between 5,000 and 10,000 Euros'],
[3, '3- Between 10,000 and 15,000 Euros'],
[4, '4- Between 15,000 and 20,000 Euros'],
[5, '5- Between 20,000 and 25,000 Euros'],
[6, '6- Greater than 25,000 Euros'],
],
widget=widgets.RadioSelect,
label="e. Please estimate your gross annual income (including your scholarships and student loan) in Euros. (Note: Your own income, not that of your parents)",
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. Country - previous accommodation",
blank=False
)
q_46_logement_ville = models.StringField(
label="g. City - previous accommodation",
blank=False
)
q_31 = models.IntegerField() # nbre d'enfant
q_47_residence = models.IntegerField(
label="i. You currently live in:",
choices=[
[1, 'Bâtiment 103'],
[2, 'Another residence '],
],
widget=widgets.RadioSelect,
blank=False
)
q_48_satisfaction = models.IntegerField(
choices=[
[1, '1 - Very satisfied'],
[2, '2 - Satisfied '],
[3, '3 - Unsatisfied '],
[4, '4 - Very unsatisfied'],
],
widget=widgets.RadioSelect,
label="j. How satisfied are you with your place of residence? ",
blank=True
)
q_49_propositions = models.StringField(
label="k. Do you have any ideas or suggestions for improvements concerning your place of residence?",
blank=True
)
lastname = models.StringField(
label="Last Name",
blank=False
)
firstname = models.StringField(
label="First Name",
blank=False
)
email = models.StringField(
label="Email",
blank=False
)
room = models.StringField(
label="Room number (for example: 103.3.09)",
blank=False
)
id_in_group_nn = models.IntegerField()
gainfinal_eur = models.FloatField()
gainfinal_eur_showupfee = models.FloatField()
gainfinal_asso_eur = models.FloatField()
gainfinal_eur_f = models.FloatField()
gainfinal_eur_showupfee_f = models.FloatField()
gainfinal_asso_eur_f = models.FloatField()

150
a5_questfin/pages.py Normal file
View File

@ -0,0 +1,150 @@
from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants
import random
import time
class Bienvenue(Page):
form_model = 'player'
form_fields = []
def before_next_page(self):
self.player.app_sequence_select = self.player.participant.vars['app_sequence_select']
self.player.app_sequence_select_n =self.player.participant.vars['app_sequence_select_n']
self.player.questionnaire_before = self.player.participant.vars['questionnaire_before']
self.player.game_num_select = random.randint(1,4)
self.player.game_select_n = getattr(Constants, f'app_seq{self.player.app_sequence_select}')[self.player.game_num_select-1]
# result of GP
self.player.tirageriskresult = self.participant.vars['tirageriskresult_j1']
if self.player.tirageriskresult == "Succès":
self.player.tirageriskresult_en = "Success"
elif self.player.tirageriskresult == "Echec":
self.player.tirageriskresult_en = "Failure"
self.player.risk11_a = self.participant.vars['risk11_a_j1']
self.player.risk11_b = self.participant.vars['risk11_b_j1']
self.player.gainrisk = self.participant.vars['gainrisk_j1']
self.player.gainrisk_eur = self.player.gainrisk * Constants.exchangerate_gp_bw
# result of BW
self.player.tirage_color_n = self.participant.vars['tirage_color_n']
self.player.gain_bw = self.participant.vars['gain_bw']
self.player.gain_bw_eur = self.participant.vars['gain_bw_eur']
# result of MDG_asso
self.player.mdgasso_dgm_selected = self.player.participant.vars['mdgasso_dgm_selected']
self.player.mdgasso_round_selected = self.player.participant.vars['mdgasso_round_selected']
self.player.mdgasso_dot1_select = self.player.participant.vars['mdgasso_dot1_select']
self.player.mdgasso_s1_select = self.player.participant.vars['mdgasso_s1_select']
self.player.mdgasso_g1_select = self.player.participant.vars['mdgasso_g1_select']
self.player.mdgasso_keep_select = self.player.participant.vars['mdgasso_keep_select']
self.player.mdgasso_sent_select = self.player.participant.vars['mdgasso_sent_select']
self.player.mdgasso_gain_dgm = self.player.participant.vars['mdgasso_gain_dgm']
self.player.mdgasso_gain_asso = self.player.participant.vars['mdgasso_gain_asso']
self.player.mdgasso_gain_dgm_eur = self.player.participant.vars['mdgasso_gain_dgm_eur']
self.player.mdgasso_gain_asso_eur = self.player.participant.vars['mdgasso_gain_asso_eur']
# result of MDG_classique
self.player.mdgclass_dgm_selected = self.player.participant.vars['mdgclass_dgm_selected']
self.player.mdgclass_round_selected = self.player.participant.vars['mdgclass_round_selected']
self.player.mdgclass_dot1_select = self.player.participant.vars['mdgclass_dot1_select']
self.player.mdgclass_s1_select = self.player.participant.vars['mdgclass_s1_select']
self.player.mdgclass_g1_select = self.player.participant.vars['mdgclass_g1_select']
self.player.mdgclass_keep_select = self.player.participant.vars['mdgclass_keep_select']
self.player.mdgclass_sent_select = self.player.participant.vars['mdgclass_sent_select']
self.player.mdgclass_gain_dgm = self.player.participant.vars['mdgclass_gain_dgm']
self.player.mdgclass_gain_joueur2 = self.player.participant.vars['mdgclass_gain_joueur2']
self.player.mdgclass_gain_dgm_eur = self.player.participant.vars['mdgclass_gain_dgm_eur']
self.player.mdgclass_gain_joueur2_eur = self.player.participant.vars['mdgclass_gain_joueur2_eur']
self.player.dictatorYES = random.randint(0, 1)
if self.player.dictatorYES == 1:
self.player.dictatorYES_n = "player_1"
elif self.player.dictatorYES == 0:
self.player.dictatorYES_n = "player_2"
if self.player.game_select_n == "gp":
self.player.game_select = 1
self.player.gainfinal_eur = self.player.gainrisk_eur
self.player.gainfinal_eur_showupfee = self.player.gainfinal_eur + Constants.showupfee
elif self.player.game_select_n == "bw":
self.player.game_select = 2
self.player.gainfinal_eur = self.player.gain_bw_eur
self.player.gainfinal_eur_showupfee = self.player.gainfinal_eur + Constants.showupfee
elif self.player.game_select_n == "MDG_asso":
self.player.game_select = 3
self.player.gainfinal_eur = self.player.mdgasso_gain_dgm_eur
self.player.gainfinal_eur_showupfee = self.player.gainfinal_eur + Constants.showupfee
self.player.gainfinal_asso_eur = self.player.mdgasso_gain_asso_eur
self.player.gainfinal_asso_eur_f = round(self.player.gainfinal_asso_eur, 0)
elif self.player.game_select_n == "MDG_class" and self.player.dictatorYES == 1:
self.player.game_select = 4
self.player.gainfinal_eur = self.player.mdgclass_gain_dgm_eur
self.player.gainfinal_eur_showupfee = self.player.gainfinal_eur + Constants.showupfee
elif self.player.game_select_n == "MDG_class" and self.player.dictatorYES == 0:
self.player.game_select = 4
self.player.gainfinal_eur = -999
self.player.gainfinal_eur_showupfee = -999
self.player.gainfinal_eur_f = round(self.player.gainfinal_eur,0)
self.player.gainfinal_eur_showupfee_f = round(self.player.gainfinal_eur_showupfee,0)
# if self.player.game_select_n != "MDG_class" :
# self.player.payoff = self.player.gainfinal_eur_showupfee
# elif self.player.game_select_n == "MDG_class" and self.player.dictatorYES == 1:
# self.player.payoff = self.player.gainfinal_eur_showupfee
# elif self.player.game_select_n == "MDG_class" and self.player.dictatorYES == 0:
# self.player.payoff = -999
class Questionnaire4(Page):
form_model = 'player'
form_fields = ['q_40_etude', 'q_41_gender', 'q_42_age',
'q_43_nationalite', 'q_44_revenu',
'q3_countries', 'q_46_logement_ville', 'q_31',
'q_47_residence', 'q_48_satisfaction', 'q_49_propositions'
]
class Result(Page):
form_model = 'player'
form_fields = [
'lastname',
'firstname',
'email',
'room',
]
class FinalPage(Page):
pass
class FinalPage2(Page):
def vars_for_template(self):
return dict(
game_select=self.player.game_select,
)
page_sequence = [
Bienvenue,
Questionnaire4,
Result,
#FinalPage, # page test à désactiver
FinalPage2,
]

View File

@ -0,0 +1,79 @@
{% load otree %}
<table class="table">
<thead class="thead-light">
<tr>
<th> Participant ID</th>
<th> Participant Label</th>
<th> gainrisk_eur</th>
<th> gain_bw_eur</th>
<th> mdgasso_gain_dgm_eur</th>
<th> mdgasso_gain_asso_eur</th>
<th> mdgclass_gain_dgm_eur</th>
<th> dgm_select</th>
<th> round_select</th>
<th> dotation</th>
<th> s1</th>
<th> g1</th>
<th> keep_byj1</th>
<th> sent_toj2</th>
<th> mdgclass_gain_j2_points</th>
<th> mdgclass_gain_j2_eur</th>
<th> app_seq</th>
<th> game_num_select</th>
<th> firstname</th>
<th> lastname</th>
<th> email</th>
<th> room</th>
<th> dictatorYES</th>
<th> game_select_n</th>
<th> gainfinal_eur</th>
<th> gainfinalshowupfee_eur</th>
<th> gainfinal_asso_eur</th>
</tr>
</thead>
<tbody>
{% for row in report %}
<tr>
<td>{{ row.id }}</td>
<td>{{ row.label }}</td>
<td> {{row.gainrisk_eur}}</td>
<td> {{row.gain_bw_eur }}</td>
<td> {{row.mdgasso_gain_dgm_eur}}</td>
<td> {{row.mdgasso_gain_asso_eur}}</td>
<td> {{row.mdgclass_gain_dgm_eur}}</td>
<td> {{row.mdgclass_dgm_selected }} </td>
<td> {{row.mdgclass_round_selected}} </td>
<td> {{row.mdgclass_dot1_select }} </td>
<td> {{row.mdgclass_s1_select}} </td>
<td> {{row.mdgclass_g1_select}} </td>
<td> {{row.mdgclass_keep_select}} </td>
<td> {{row.mdgclass_sent_select}} </td>
<td> {{row.mdgclass_gain_joueur2}}</td>
<td> {{row.mdgclass_gain_joueur2_eur}}</td>
<td> {{row.app_sequence_select_n }}</td>
<td> {{row.game_num_select}}</td>
<td> {{row.firstname}}</td>
<td> {{row.lastname}}</td>
<td> {{row.email}}</td>
<td> {{row.room}}</td>
<td> {{row.dictatorYES}}</td>
<td> {{row.game_select_n}}</td>
<td> {{row.gainfinal_eur_f}}</td>
<td> {{row.gainfinal_eur_showupfee_f}}</td>
<td> {{row.gainfinal_asso_eur_f}}</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,41 @@
<head>
<style>
.hide {
display: none;
}
</style>
<title></title>
</head>
{% extends "global/Page.html" %}
{% load otree %}
{% block title %}
{% endblock %}
{% block content %}
<div class="card bg-light m-3">
<div class="card-body">
<p>
<h3>
Please click on the "Next" button to go to the next step
</h3>
</p>
<p>{% next_button %}</p>
</div></div>
{% endblock %}

Some files were not shown because too many files have changed in this diff Show More