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_algo_explanation' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): def creating_session(self): for p in self.get_players(): questions = ['I think the recommendations of the algorithm will be valuable.', 'I think that I will make better forecasts with the recommendation of the algorithm than on my own.'] question_order = [] # print("Länge Questions: " + str(len(questions))) for r in range(1,len(questions)+1): question_order.append(r) #random.shuffle(question_order) #Use if order of questions should be shuffled p.participant.vars['questions_aft_explain'] = questions p.participant.vars['questions_aft_explain_order'] = question_order # print('Participant ID in subsesseion: ' + str(p.id_in_subsession) + '| Question Order: ' + str(p.participant.vars['questions_aft_explain_order'])) class Group(BaseGroup): pass class Player(BasePlayer): questions_aft_explain_answers = models.StringField() questions_aft_explain_order = models.StringField()