from otree import settings from otree.api import * import time doc = """ Final """ #SESSION class Constants(BaseConstants): name_in_url = "CountingPost" players_per_group = None num_rounds = 1 #SUBSESSION class Subsession(BaseSubsession): pass #GROUP class Group(BaseGroup): pass ##PLAYER class Player(BasePlayer): time_survey0 = models.FloatField() time_survey1 = models.FloatField() experience_check = models.IntegerField( choices=[[1, "Version A"], [2, "Version B"]], label="Which version of the task did you just complete?", widget=widgets.RadioSelect, blank=True ) #FUNCTIONS def experience_check_error_message(player, value): if value not in [1, 2]: return 'You have to select one of the options.' #PAGES class ExperienceCheck(Page): form_model = 'player' form_fields = ['experience_check'] @staticmethod def before_next_page(player, timeout_happened): player.time_survey0 = round(time.time(),3) def is_displayed(player): participant = player.participant return participant.treatment in ['MIXED0', 'MIXED1'] class End(Page): form_model = 'player' @staticmethod def before_next_page(player, timeout_happened): player.time_survey1 = round(time.time(),3) def is_displayed(player): participant = player.participant return participant.treatment in ['MIXED0', 'MIXED1'] #SEQUENCE page_sequence = [ExperienceCheck, End]