from otree.api import * author = 'Sara Neff' doc = """ survey for experimental testing and feedback """ class C(BaseConstants): NAME_IN_URL = 'Survey' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): device = models.StringField( blank=True, choices=['Mac or Macbook', 'iPad', 'iPhone', 'PC desktop or laptop', 'Android smartphone', 'Other'], label=''' Which type of device did you use to take the experiment? ''' ) device_other = models.StringField( blank=True, label=''' Please tell us which other device you used: ''' ) browser = models.StringField( blank=True, choices=['Safari', 'Chrome', 'Other'], label=''' Which web browser did you use to take the experiment? ''' ) browser_other = models.StringField( blank=True, label=''' Please tell us which other browser you used: ''' ) technical = models.StringField( blank=True, choices=['Yes', 'No'], label=''' Did you have any technical problems? ''' ) technical_yes = models.StringField( blank=True, label=''' Please tell us what technical problem(s) you experienced: ''' ) research = models.StringField( blank=True, label=''' What did you think we were trying to learn? ''' ) advice = models.StringField( blank=True, label=''' If you had to advise a cohort member how to perform the tasks in Part 1, what would you tell him or her? ''' ) comments = models.StringField( blank=True, label=''' What did you think of the experiment? Do you have any comments or feedback? ''' ) class Play1(Page): form_model = 'player' form_fields = ['device'] class Play1other(Page): @staticmethod def is_displayed(player: Player): return player.device == 'Other' form_model = 'player' form_fields = ['device_other'] class Play2(Page): form_model = 'player' form_fields = ['browser'] class Play2other(Page): @staticmethod def is_displayed(player: Player): return player.browser == 'Other' form_model = 'player' form_fields = ['browser_other'] class Play3(Page): form_model = 'player' form_fields = ['technical'] class Play3yes(Page): @staticmethod def is_displayed(player: Player): return player.technical == 'Yes' form_model = 'player' form_fields = ['technical_yes'] class Play4(Page): form_model = 'player' form_fields = ['research'] class Play5(Page): form_model = 'player' form_fields = ['advice'] class Play6(Page): form_model = 'player' form_fields = ['comments'] class End(Page): pass page_sequence = [Play1, Play1other, Play2, Play2other, Play3, Play3yes, Play4, Play5, Play6, End] def custom_export(players): yield [ 'participant', 'device', 'other device' 'browser', 'other browser' 'technical', 'technical problem' 'research', 'advice', 'comments' ] for p in players: pp = p.participant yield [ pp.code, p.device, p.device_other, p.browser, p.browser_other, p.technical, p.technical_yes, p.research, p.advice, p.comments ]