from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer ) import csv author = 'Eveline Vandewal' doc = """ Prolific Study with Visible Payoffs """ class Constants(BaseConstants): name_in_url = 'Prolific_Visible' players_per_group = None with open('Prolific_Visible/payoffs.csv') as problems_file: problems = list(csv.DictReader(problems_file)) num_rounds = len(problems) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): consent = models.IntegerField( choices=[ [1, 'Yes'], [2, 'No'] ], widget=widgets.RadioSelect ) colors_reversed = models.IntegerField() roles_reversed = models.IntegerField() problem_id = models.IntegerField() problem_type = models.IntegerField() payoff_a = models.IntegerField() payoff_b = models.IntegerField() payoff_c = models.IntegerField() payoff_d = models.IntegerField() payoff_e = models.IntegerField() payoff_f = models.IntegerField() payoff_g = models.IntegerField() payoff_h = models.IntegerField() q1 = models.IntegerField( choices=[ [1, 'ROW PARTICIPANT'], [2, 'COLUMN PARTICIPANT'] ], widget=widgets.RadioSelect ) q2 = models.IntegerField() q3 = models.IntegerField() q1_error = models.BooleanField() q2_error = models.BooleanField() q3_error = models.BooleanField() q4 = models.IntegerField( widget=widgets.RadioSelect ) q5 = models.IntegerField( choices=[ [1, 'Yes'], [2, 'No'] ], widget=widgets.RadioSelect ) q4_error = models.BooleanField() q5_error = models.BooleanField() cq_error = models.BooleanField() practice_submitted_choice = models.IntegerField( choices=[ [1, 'Left / Up'], [2, 'Right / Down'] ], widget=widgets.RadioSelect ) practice_submitted_belief = models.IntegerField() submitted_choice = models.IntegerField( choices=[ [1, 'Left / Up'], [2, 'Right / Down'] ], widget=widgets.RadioSelect ) submitted_belief = models.IntegerField() first_name = models.StringField() last_name = models.StringField() address = models.StringField() city = models.StringField() country = models.StringField() dob = models.StringField() iban = models.StringField() email = models.StringField(blank=True) def current_problem(self): return self.participant.vars['randomized_problems'][self.round_number - 1]