Test_Johanne/exp_e4c_fr_p2bis_risk_gneezy_end/models.py

110 lines
2.3 KiB
Python
Raw Normal View History

2025-03-06 10:28:01 +01:00
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 = 'exp_e4c_fr_p2bis_risk_gneezy_end'
players_per_group = None
num_rounds = 1
showupfee = 0
instructions_GP_template = 'exp_e4c_fr_p2bis_risk_gneezy_end/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]
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()