import random from otree.api import * doc = """ Introduction """ class C(BaseConstants): NAME_IN_URL = 'intro' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 MIN_TIME = 15 # in minutes MAX_TIME = 25 # in minutes BONUS_PER_CORRECT_TASK_PART1 = cu(0.15) OUTSIDE_OPTION = cu(2.2) MAX_BONUS = cu(4.5) NUMBER_OF_TASKS_PART1 = 2 NUMBER_OF_TASKS_PART2 = 10 PART1_INTRO_TEMPLATE = 'intro/part1.html' PART2_INTRO_TEMPLATE = 'intro/part2.html' BONUS_INTRO_TEMPLATE = 'intro/bonus.html' COMPUTER_INTRO_TYPES = 'intro/computerTypes.html' REVIEW_INSTRUCTIONS = 'intro/reviewInstructions.html' NUMBER_OF_STAGES = 3 # modify jointly with word below NUMBER_OF_STAGES_WORD = 'three' # modify jointly with number above INSTRUCTIONS1_TEMPLATE = 'informational_cost/instructions1_template.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): pass # PAGES class Welcome(Page): pass class Consent(Page): pass class Instructions(Page): @staticmethod def app_after_this_page(player, upcoming_apps): if player.participant.treatment == 'strategy' or player.participant.treatment == 'plan': return upcoming_apps[1] # class IntroduceStages(Page): # pass # class Instructions1(Page): # pass # class CQ(Page): # form_model = 'player' # # @staticmethod # def get_form_fields(player): # questions = ['cq1', 'cq2', 'cq3', 'cq4'] # if player.participant.det: # questions = [x + '_det' for x in questions] # return questions # # @staticmethod # def error_message(player, values): # if not player.session.config['development']: # if not player.participant.det: # solutions = dict(cq1=2, # cq2=1, # cq3=3, # cq4=2, # # cq5=3 # ) # else: # solutions = dict(cq1_det=2, # cq2_det=2, # cq3_det=3, # cq4_det=2 # ) # error_messages = dict() # for field_name in solutions: # if values[field_name] is None: # error_messages[field_name] = 'Please, answer the question.' # elif values[field_name] != solutions[field_name]: # error_messages[field_name] = 'Please, correct your answer!' # name = 'player.' + str(field_name) + '_mistakes' # exec("%s += 1" % name) # return error_messages # # @staticmethod # def before_next_page(player: Player, timeout_happened): # player.intro_cq_mistakes = player.cq1_mistakes + player.cq2_mistakes + player.cq3_mistakes + player.cq4_mistakes + \ # player.cq5_mistakes + player.cq1_det_mistakes + player.cq2_det_mistakes + player.cq3_det_mistakes + \ # player.cq4_det_mistakes # # class Instructions2(Page): # pass page_sequence = [ Welcome, Consent, Instructions # IntroduceStages, # 3 PARTS, MAYBE ONLY PAY ONE. # Instructions1, # INSTRUCTIONS 1, ADAPT TO NEW FRAMEWORK # CQ, # Instructions2 ]