from otree.api import * from random import shuffle class C(BaseConstants): NAME_IN_URL = 'MainSurvey' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass # from disagree to agree scale def likert_scale1(label): return models.IntegerField( choices=[ [1, 'Strongly Disagree'], [2, 'Disagree'], [3, 'Somewhat Disagree'], [4, 'Somewhat Agree'], [5, 'Agree'], [6, 'Strongly Agree']], label=label, ) # from agree to disagree def likert_scale2(label): return models.IntegerField( choices=[ [1, 'Strongly Agree'], [2, 'Agree'], [3, 'Somewhat Agree'], [4, 'Somewhat Disagree'], [5, 'Disagree'], [6, 'Strongly Disagree']], label=label, ) # from always to never def trust_scale1(label): return models.IntegerField( choices=[ [1, 'Always'], [2, 'Most of the time'], [3, 'About half of the time'], [4, 'Some of the time'], [5, 'Never']], label=label, ) # from never to always def trust_scale2(label): return models.IntegerField( choices=[ [1, 'Never'], [2, 'Some of the time'], [3, 'About half of the time'], [4, 'Most of the time'], [5, 'Always']], label=label, ) class Player(BasePlayer): ####### EXPERIMENTAL FEEDBACK ########## donor1 = models.LongStringField(label="How did you approach your decision of how much to offer for your partner in each round?") donor2 = models.LongStringField(label="Would you do anything different given the final results?") donor3 = models.LongStringField(label="How do you feel your partner treated you in each round? For instance, do you think you were treated fairly or unfairly based on your action?") #general feedback * dont force answers * general1 = models.LongStringField( blank=True, label="What do you think the behavioral games task was designed to assess?") general2 = models.LongStringField( blank=True, label="Do you have any feedback for this study?") general3 = models.LongStringField( blank=True, label="Do you have any final questions, comments, or suggestions?") ####### DEMOGRAPHIC MEASURES########## gender = models.IntegerField(widget=widgets.RadioSelect, choices=[[1, 'Male'],[2, 'Female'],[3, 'Other'],],) citizen = models.IntegerField(widget=widgets.RadioSelect,choices=[ [1, 'Both parents born in the United States'], [2, 'One parent born in the United States, one parent born in another country'], [3, 'Both parents born in another country or countries'],], ) education = models.IntegerField( choices=[ [1, 'Less than High School Degree'], [2, 'High School Degree'], [3, 'Less than Undergraduate Degree'], [4, 'Undergraduate Degree'], [5, 'Master Degree'], [6, 'Graduate Degree']],) partyid = models.IntegerField(widget=widgets.RadioSelect, choices=[[1, 'Democrat'],[2, 'Republican'], [3, 'Independent'],[4, 'Other']],) partyid_imp = models.IntegerField( choices=[ [1, 'Extremely liberal'], [2, 'Liberal'], [3, 'Slightly liberal'], [4, 'Moderate; middle of the road'], [5, 'Slighly conservative'], [6, 'Conservative'], [7, 'Extremely conservative'],],) zipcode = models.IntegerField() ########## Trust MEASURES########## govertrust = trust_scale2("Government Trust") friendtrust = trust_scale1("Friendship Trust") generaltrust= models.StringField( choices=[ [1, "Can be trusted"], [2, "Can't be too careful"], [3, 'Depends']]) ########## IDENTITY MEASURES########## racialid = likert_scale1("Racial Identity") ethnicid = likert_scale2("Ethnic Identity") americanid = likert_scale1("American Identity") politicalid = likert_scale2("Political Identity") # Partricipant attention - change scale attention = models.StringField(widget=widgets.RadioSelect, choices=[ [1, 'Never'], [2, 'A little'], [3, 'A moderate amount'], [4, 'A lot'], [5, 'Almost all the time or all the time']]) ########## Racial Exposure and Contact ########## contact= models.StringField(widget=widgets.RadioSelect, choices=[ [1, 'None at all'], [2, 'A little'], [3, 'A moderate amount'], [4, 'A lot'], [5, 'Almost all the time or all the time']]) friendship= models.StringField( choices=[[1,2,3,4,5,6,7,8,9,10]], label= "How many of your close friends have a different ethnic or racial background from your own") ##### Discrimination ###### discriminatio_per= models.StringField( choices=[ [1, 'None at all'], [2, 'A little'], [3, 'A moderate amount'], [4, 'A lot '], [5, 'A great deal']]) discrimination_group= models.StringField( choices=[ [1, 'None at all'], [2, 'A little'], [3, 'A moderate amount'], [4, 'A lot '], [5, 'A great deal']]) attention2 = models.StringField(widget=widgets.RadioSelect, choices=[ [1, 'Never'], [2, 'A little'], [3, 'A moderate amount'], [4, 'A lot'], [5, 'Almost all the time or all the time']]) ########## Group Rating Measures ########## whiterating = models.IntegerField( label="How would you rate White Americans?") demorating = models.IntegerField( label="How would you rate Democrats?") blackrating = models.IntegerField( label="How would you rate Blacks/African Americans?") asianrating = models.IntegerField( label="How would you rate Asian Americans?") immigrantrating = models.IntegerField( label="How would you rate Immigrants?") latinorating = models.IntegerField( label="How would you rate Hispanic/Latinos?") repubrating = models.IntegerField( label="How would you rate Republicans?") # PAGES class Feedback1(Page): form_model = 'player' form_fields = ['donor1', 'donor2', 'donor3'] class Instructions(Page): pass class Survey1(Page): form_model = 'player' form_fields = ['gender', 'citizen', 'zipcode'] class Survey2(Page): form_model = 'player' form_fields = ['education', 'partyid', 'partyid_imp'] class Survey3(Page): form_model = 'player' form_fields = ['racialid','ethnicid','attention'] class Survey4Trust(Page): form_model = 'player' form_fields = ['govertrust','friendtrust','generaltrust'] class Survey5(Page): form_model = 'player' form_fields = ['contact','discriminatio_per', 'discrimination_group'] class Survey6Ratings(Page): form_model = 'player' form_fields = ['whiterating', 'demorating', 'blackrating', 'asianrating', 'immigrantrating','latinorating', 'repubrating'] class Survey7(Page): form_model = 'player' form_fields = ['politicalid','americanid'] class Feedback2(Page): form_model = 'player' form_fields = ['general1', 'general2', 'general3'] class Debrief (Page): pass @staticmethod def before_next_page(player, timeout_happened): player.participant.finished = True page_sequence = [Feedback1, Instructions, Survey1, Survey2, Survey3, Survey4Trust, Survey5, Survey6Ratings, Survey7, Feedback2, Debrief]