from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer ) import csv author = 'Eveline Vandewal' doc = """ Raven's Advanced Progressive Matrices """ class Constants(BaseConstants): name_in_url = 'MTSP_Part3' players_per_group = None with open('MTSP_Part3/problems.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): problem_id = models.IntegerField() problem = models.StringField() practice_submitted_choice1 = models.IntegerField( choices=[1, 2, 3, 4, 5, 6, 7, 8], widget=widgets.RadioSelect ) practice_submitted_choice2 = models.IntegerField( choices=[1, 2, 3, 4, 5, 6, 7, 8], widget=widgets.RadioSelect ) submitted_choice = models.IntegerField( choices=[1, 2, 3, 4, 5, 6, 7, 8], widget=widgets.RadioSelect ) submitted_time = models.FloatField() def current_problem(self): return self.participant.vars['randomized_problems3'][self.round_number - 1]