from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer ) import csv author = 'Eveline Vandewal' doc = """ Part 2 """ class Constants(BaseConstants): name_in_url = 'GMTA2_Part2' players_per_group = None with open('GMTA2_Part2/situations.csv') as situations_file: situations = list(csv.DictReader(situations_file)) num_rounds = len(situations) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): situation_id = models.IntegerField() label_left = models.StringField() label_right = models.StringField() task = models.StringField() order = models.IntegerField() similarity = models.IntegerField() time_pressure = models.IntegerField() perceived_similarity = models.IntegerField() position = models.IntegerField() random_position = models.IntegerField() practice_submitted_decision = models.IntegerField() practice_submitted_choice = models.IntegerField( choices=[ [1, 'Left Label'], [2, 'Right Label'] ], widget=widgets.RadioSelect ) practice_submitted_belief = models.IntegerField() practice_time_choice = models.FloatField() practice_time_choice_rounded = models.IntegerField() practice_time_belief = models.FloatField() practice_time_belief_rounded = models.IntegerField() new_practice_time_choice = models.FloatField() new_practice_time_choice_rounded = models.IntegerField() new_practice_time_belief = models.FloatField() new_practice_time_belief_rounded = models.IntegerField() practice_problem = models.BooleanField() submitted_decision = models.IntegerField() submitted_choice = models.IntegerField( choices=[ [1, 'Left Label'], [2, 'Right Label'] ], widget=widgets.RadioSelect ) submitted_belief = models.IntegerField() time_choice = models.FloatField() time_choice_rounded = models.IntegerField() time_belief = models.FloatField() time_belief_rounded = models.IntegerField() new_time_choice = models.FloatField() new_time_choice_rounded = models.IntegerField() new_time_belief = models.FloatField() new_time_belief_rounded = models.IntegerField() problem = models.BooleanField() time_begin = models.StringField() time_end = models.StringField() def current_situation(self): return Constants.situations[self.participant.vars['situation_array'][self.round_number - 1] - 1]