from otree.api import * import random import csv doc = """ This is the first session of the iq project. First Subjects have to do IQ test, ... """ # ############################################################################################################# # ########################################## MODELS ########################################################### # ############################################################################################################# class Constants(BaseConstants): name_in_url = 'questionnaire1' players_per_group = None num_rounds = 1 QuestionnaireChoices = [ [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], ] IQChoices = [ [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'] ] # we have to set actual payment, these are just example numbers so far. base_payment = 14 extra_payoff = 6 days_single = 14 days_double = 28 class Group(BaseGroup): pass class Subsession(BaseSubsession): pass class Player(BasePlayer): # Melessa_ID = models.IntegerField(min=10000, max=999999999999) Melessa_ID = models.StringField() # Demographics gender = models.IntegerField( label="Please select your gender.", choices=[ [1, 'Male'], [2, 'Female'], [3, 'Other'], [4, 'I prefer not to say.'], ] ) age = models.IntegerField(label="Please enter your age.", min=14, max=90, blank=True) attention_check_1 = models.IntegerField(label="Please enter the number 3.", blank=True) studies = models.IntegerField( label="Please estimate how many studies you have participated in (excluding this study)", choices=[ [1, 'This is my first study.'], [2, 'Between 1 and less than 5 studies.'], [3, 'between 5 and less than 10 studies.'], [4, '10 or more studies.'], # [5, 'I prefer not to say.'] ] ) degree = models.IntegerField( label="Please indicate the highest educational degree you have completed.", choices=[ [1, 'Abitur or equivalent'], [2, 'Bachelor degree or equivalent'], [3, 'Master degree or equivalent'], [4, 'PhD'], [5, 'other'] ] ) field = models.IntegerField( label="Please indicate what best describes the field of your studies.", choices=[ [1, 'Arts or Humanities'], [2, 'Economics or Business'], [3, 'Education'], [4, 'Law'], [5, 'Mathematics or Computer Science'], [6, 'Medicine'], [7, 'Natural Sciences'], [8, 'Social Sciences'], [9, 'other'], ] ) english = models.IntegerField( label="Please rate your English on a percentage scale between 0 and 100.", min=0, max=100, initial=None ) # Big 5 Survey. item1A = models.IntegerField( label='I see myself as someone who is reserved.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) item1B = models.IntegerField( label='I see myself as someone who is generally trusting.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) item1C = models.IntegerField( label='I see myself as someone who tends to be lazy.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) item1D = models.IntegerField( label='I see myself as someone who is relaxed, handles stress well.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) item1E = models.IntegerField( label='I see myself as someone who has few artistic interests.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) item1F = models.IntegerField( label='I see myself as someone who is outgoing, sociable.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) item1G = models.IntegerField( label='I see myself as someone who tends to find fault with others.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) item1H = models.IntegerField( label='I see myself as someone who does a thorough job.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) item1I = models.IntegerField( label='I see myself as someone who gets nervous easily.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) item1J = models.IntegerField( label='I see myself as someone who has an active imagination.', choices=Constants.QuestionnaireChoices, widget=widgets.RadioSelectHorizontal ) # ############################################################################################################# # ##################################### FUNCTIONS ####################################################### # ############################################################################################################# def get_id(player:Player): player.Melessa_ID = player.participant.melessa_id # ################################################################################################################## # ################################# PAGEs #################################################### # ################################################################################################################## class Part4(Page): pass class Demographics(Page): form_model = 'player' form_fields = ['gender', 'age', 'studies', 'degree', 'field', 'english', 'attention_check_1'] class Big5(Page): form_model = 'player' form_fields = [ 'item1A', 'item1B', 'item1C', 'item1D', 'item1E', 'item1F', 'item1G', 'item1H', 'item1I', 'item1J' ] class LastPage(Page): @staticmethod def vars_for_template(player: Player): return dict( Melessa_ID=get_id(player) ) class Part8(Page): pass class Part9(Page): pass page_sequence = [ Part8, Big5, Part9, Demographics, LastPage, ]