from otree.api import * doc = """ Post-experiment questionnaire: demographics, self-reported experience, and debriefing. Adapted from studies/23-shipping/software/outro (drops the audio_quality item — there are no recordings in this click-through pretest). """ class C(BaseConstants): NAME_IN_URL = 'outro' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 PRIVACY_TEMPLATE = 'onboarding/Privacy.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.IntegerField( label='Please enter your age (whole number between 18 and 99).', min=18, max=99, ) gender = models.IntegerField( label='What is your gender identity?', widget=widgets.RadioSelect, choices=[ [1, 'Male'], [2, 'Female'], [3, 'Non-binary'], [4, 'Transgender'], [5, 'Other'], [6, 'Prefer not to say'], ], ) extra_comments = models.LongStringField( blank=True, label='Anything else you would like to tell us?', ) study_experience = models.IntegerField( label='How would you rate your overall experience with this study?', widget=widgets.RadioSelect, choices=[ [1, 'Very negative'], [2, 'Negative'], [3, 'Somewhat negative'], [4, 'Neutral'], [5, 'Somewhat positive'], [6, 'Positive'], [7, 'Very positive'], ], ) difficulties = models.IntegerField( label='Did you experience any technical or task-related difficulties?', widget=widgets.RadioSelect, choices=[ [0, 'No'], [1, 'Yes'], ], ) difficulties_description = models.LongStringField( blank=True, label='If yes, please briefly describe:', ) class Demographics(Page): form_model = 'player' form_fields = ['age', 'gender', 'extra_comments'] class Experience(Page): form_model = 'player' form_fields = ['study_experience', 'difficulties', 'difficulties_description'] @staticmethod def before_next_page(player: Player, timeout_happened): player.participant.finished = True class Debriefing(Page): @staticmethod def vars_for_template(player: Player): from settings import PROLIFIC_COMPLETION_URL try: url = player.session.prolific_completion_url or PROLIFIC_COMPLETION_URL except KeyError: url = PROLIFIC_COMPLETION_URL return dict(prolific_completion_url=url) page_sequence = [Demographics, Experience, Debriefing] def custom_export(players): yield [ 'session_code', 'participant_code', 'age', 'gender', 'extra_comments', 'study_experience', 'difficulties', 'difficulties_description', ] for p in players: yield [ p.session.code, p.participant.code, p.field_maybe_none('age'), p.field_maybe_none('gender'), p.field_maybe_none('extra_comments'), p.field_maybe_none('study_experience'), p.field_maybe_none('difficulties'), p.field_maybe_none('difficulties_description'), ]