e4c_expe2/a3_gp/models.py
Johanne Trotin 981d06d34c Expé E4C v6
2025-03-30 12:32:15 +02:00

141 lines
3.0 KiB
Python

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
)
risk_assessment_gp = models.IntegerField(
choices=[[i, str(i)] for i in range(1, 8)],
label="",
widget=widgets.RadioSelectHorizontal,
blank=False
)
confidence_level_gp = models.IntegerField(
choices=[[i, str(i)] for i in range(1, 8)],
label="",
widget=widgets.RadioSelectHorizontal,
blank=False
)
memory_recall_gp = models.IntegerField(
choices=[[i, str(i)] for i in range(1, 8)],
label="",
widget=widgets.RadioSelectHorizontal,
blank=False
)
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()