from otree.api import * import time author = 'Thomas' class C(BaseConstants): NAME_IN_URL = 'Intro' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): survey_participate = models.IntegerField( label="Möchten Sie an der Befragung teilnehmen?", blank=False, choices=[ [1, 'Ja. Ich möchte teilnehmen.'], [0, 'Nein. Ich möchte nicht teilnehmen.'] ] ) survey_start = models.FloatField() panelist_id = models.StringField(blank=True) class Intro(Page): form_model = 'player' form_fields = ['survey_participate'] @staticmethod def before_next_page(player, timeout_happened): player.participant.vars['survey_participate'] = player.survey_participate player.participant.quota_screened_out = False player.participant.quota_counted = False if 'survey_start' not in player.participant.vars: start_time = time.time() player.participant.vars['survey_start'] = start_time player.survey_start = start_time else: player.survey_start = player.participant.vars['survey_start'] # Respondi ID passed through participant_label player.panelist_id = player.participant.label or '' page_sequence = [Intro]