from otree.api import * import random import itertools doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'survey_fin' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def creating_session(subsession): #if subsession.round_number == 1: import random for player in subsession.get_players(): player.participant.lottery = random.randint(1, 2) class Player(BasePlayer): end_1 = models.StringField( choices=[['Very Much', 'Very Much'], ['Much', 'Much'], ['Somewhat', 'Somewhat'], ['A little', 'A little'], ['Not at all', 'Not at all']], widget=widgets.RadioSelect, label='Feeling motivated', ) end_2 = models.StringField( choices=[['Very Much', 'Very Much'], ['Much', 'Much'], ['Somewhat', 'Somewhat'], ['A little', 'A little'], ['Not at all', 'Not at all']], widget=widgets.RadioSelect, label='Feeling frustrated', ) end_3 = models.StringField( choices=[['Very Much', 'Very Much'], ['Much', 'Much'], ['Somewhat', 'Somewhat'], ['A little', 'A little'], ['Not at all', 'Not at all']], widget=widgets.RadioSelect, label='Feeling bored', ) end_4 = models.StringField( choices=[['Very Much', 'Very Much'], ['Much', 'Much'], ['Somewhat', 'Somewhat'], ['A little', 'A little'], ['Not at all', 'Not at all']], widget=widgets.RadioSelect, label='Feeling mentally stimulated', ) end_5 = models.StringField( choices=[['Very Much', 'Very Much'], ['Much', 'Much'], ['Somewhat', 'Somewhat'], ['A little', 'A little'], ['Not at all', 'Not at all']], widget=widgets.RadioSelect, label='Feeling confused', ) end_6 = models.StringField( choices=[['Very Much', 'Very Much'], ['Much', 'Much'], ['Somewhat', 'Somewhat'], ['A little', 'A little'], ['Not at all', 'Not at all']], widget=widgets.RadioSelect, label='Feeling tired', ) end_7 = models.StringField( choices=[['Very Much', 'Very Much'], ['Much', 'Much'], ['Somewhat', 'Somewhat'], ['A little', 'A little'], ['Not at all', 'Not at all']], widget=widgets.RadioSelect, label='Feeling curious', ) end_8 = models.LongStringField( label='Is there any other emotion/reason that influenced your performance and/or decision?', ) end_9 = models.BooleanField( choices=[[False, 'No'], [True, 'Yes']], widget=widgets.RadioSelect, label='Do you feel like the first round task negatively influenced your confidence in choosing more difficult letter series in the second round?', ) end_10 = models.LongStringField( label='Suppose you had to perform the encryption task one more time, what difficulty level would you choose? (see table below as a reference)', ) end_11 = models.LongStringField( label='Write here any other comment', ) # PAGES class SurveyQuestions(Page): form_model = "player" @staticmethod def get_form_fields(player: Player): form_fields = ["end_1", "end_2", "end_3", "end_4", "end_5", "end_6", "end_7",] random.shuffle(form_fields) return form_fields class survey2(Page): form_model = "player" @staticmethod def get_form_fields(player: Player): form_fields = ["end_8", "end_9", "end_10", "end_11",] return form_fields class final_page(Page): form_model = "player" @staticmethod def vars_for_template(player: Player): return { 'lottery': player.participant.lottery, 'completion_code': "C1DVBP2U", } page_sequence = [SurveyQuestions, survey2, final_page]