experiment-template/Start/__init__.py
duartegoncalvesds 73fc2121bf first commit
2026-03-12 21:05:38 +00:00

50 lines
1.1 KiB
Python

from otree import session
from otree.api import *
doc = """
Landing page with consent.
"""
class C(BaseConstants):
NAME_IN_URL = 'Start'
PLAYERS_PER_GROUP = None
NUM_ROUNDS = 1
class Subsession(BaseSubsession):
pass
class Group(BaseGroup):
pass
class Player(BasePlayer):
consent = models.BooleanField(blank=True)
exp = models.IntegerField()
# FUNCTIONS
# PAGES
class Welcome(Page):
form_model = 'player'
form_fields = ['consent']
@staticmethod
def vars_for_template(player):
return dict(
participation_fee=float(player.session.config['participation_fee']),
max_payment=float(player.session.config['max_payment']),
use_captchas=player.session.config['use_captchas'],
estimated_completion_time=player.session.config['estimated_completion_time'],
# usinstructions = player.session.config['usinstructions'],
)
@staticmethod
def before_next_page(player: Player, timeout_happened):
player.exp = 1
player.participant.vars['exp'] = 1
page_sequence = [Welcome]