from otree.api import * doc = """ Pre-experiment survey """ class Constants(BaseConstants): name_in_url = 'SVY_Pilot' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def make_q(label): return models.IntegerField(blank=True, label=label, choices=[1, 2, 3, 4, 5], widget=widgets.RadioSelect) def risk(A): return models.IntegerField(blank=True, label=A, choices=[1, 2, 3, 4, 5, 6, 7], widget=widgets.RadioSelect) # Social preference (compassion, altruism, willingness to share, prosocial behavior) class Player(BasePlayer): # SONA ID sona = models.StringField(label ='') # Optimism q1 = make_q('(1) In uncertain times, I usually expect the best.') q2 = make_q('(2) It is easy for me to relax.') q3 = make_q('(3) If something can go wrong for me, it will.') q4 = make_q('(4) I am always optimistic about my future.') q5 = make_q('(5) I enjoy my friends a lot.') q6 = make_q('(6) It is important for me to keep busy.') q7 = make_q('(7) I HARDLY ever expect things to go on my way.') q8 = make_q('(8) I do NOT get upset too easily.') q9 = make_q('(9) I RARELY count on good things happening to me.') q10 = make_q('(10) Overall, I expect more good things to happen to me than bad.') # Resilience q11 = make_q('(1) I look for creative ways to alter difficult situations.') q12 = make_q('(2) Regardless of what happens to me, I believe I can control my reaction to it.') q13 = make_q('(3) I believe I can grow in positive ways by dealing with difficult situations.') q14 = make_q('(4) I actively look for ways to replace the losses I encounter in life.') # Risk (not for a pilot) q15 = risk('(1) I prefer to carefully analyze a situation before moving.') q16 = risk('(2) I favor the tried and true ') q17 = risk('(3) I have a tendency to follow other people ') q18 = risk('(4) I have a strong preference for high-risk projects.') # Math ability math1 = models.IntegerField(blank=True, label='',) math2 = models.FloatField(blank=True, label='',) # PAGES class Info(Page): form_model = 'player' form_fields = ['sona'] class O(Page): form_model = 'player' form_fields = ['q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q7', 'q8', 'q9','q10'] class R(Page): form_model = 'player' form_fields = ['q11', 'q12', 'q13', 'q14'] class M(Page): form_model = 'player' form_fields = ['math1', 'math2'] class Ri(Page): form_model = 'player' form_fields = ['q15', 'q16', 'q17', 'q18'] class End(Page): pass page_sequence = [Info, O, R, M, End]