from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'fc_end' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): def creating_session(self): for p in self.get_players(): #QUESTIONS PERCEIVED VALUE / TRUST questions_trust = ['The algorithm was reliable', 'The algorithm was dependable', 'The algorithm was understandable', 'The algorithm was accessible'] questions_trust_order = [] # print("Länge Questions: " + str(len(questions_trust))) for r in range(1,(len(questions_trust)+1)): questions_trust_order.append(r) # random.shuffle(questions_trust_order) # Use this to shuffle questions p.participant.vars['questions_trust'] = questions_trust p.participant.vars['questions_trust_order'] = questions_trust_order # print('Participant ID in subsesseion: ' + str(p.id_in_subsession) + '| Trust Question Order: ' + str(p.participant.vars['questions_trust_order'])) #QUESTIONS HIT questions_hit = ['My task was clear to me at any time during the HIT.', 'I enjoyed the task in this HIT', 'I am satisfied with the reward I receive for participating in this HIT', 'I would take part in a similar HIT again'] questions_hit_order = [] for r in range(1,(len(questions_hit)+1)): questions_hit_order.append(r) p.participant.vars['questions_hit'] = questions_hit p.participant.vars['questions_hit_order'] = questions_hit_order # print('Participant ID in subsesseion: ' + str(p.id_in_subsession) + '| Trust Question Order: ' + str(p.participant.vars['questions_hit_order'])) class Group(BaseGroup): pass class Player(BasePlayer): questions_trust_answers = models.StringField() questions_trust_order = models.StringField() gender = models.StringField( label="Your gender:", choices=['male' , 'female', 'other'], widget=widgets.RadioSelect ) age = models.StringField( label="Your age:", choices=['18 - 30' , '31 - 40', '41 - 50', '51 - 60', '61 - 70', '71 - 80', '81 - 90', '91 - 99', 'I don\'t want to report.'] ) education = models.StringField( label="Your educational level:", choices=['Less than highschool degree', 'High school graduate (high school diploma or equivalent)' , 'Some college but no degree', 'Bachelor\'s degree', 'Master\'s degree', 'Doctoral degree (PhD)', 'Advanced Professional Degree (JD, MD, MBA, etc.)', 'I don\'t want to report.'], ) general_comments = models.TextField(label="Do you have any further comments? (optional)", blank = True)