from otree.api import * from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c ) doc = """ Your app description """ class Constants(BaseConstants): name_in_url = '_welcome' players_per_group = None num_rounds = 1 part_number_total = 3 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): fullatt = models.StringField( label = 'Once you are ready to participate, please type this exact sentence into the box below: "I will complete this 20-minute study with my full attention.” and press “Next” .', blank=False, initial='', ) understand1 = models.IntegerField( label = "For completing this study, how much payment will you receive?", choices=[ [1, "$4 + a guaranteed bonus payment within one week"], [2, "$4 + no chance of bonus payment"], [3, "$4 + any additional bonus payment that results from the part-that-counts within five business days"], ], initial = 0, widget = widgets.RadioSelect, ) understand2 = models.IntegerField( label="Your additional payment will...", choices=[ [1, "... not depend on your decisions in the part-that-counts."], [2, "... be equal to $1 regardless of your decisions in the part-that-counts"], [3, "... depend on my decisions and potentially decisions of others in the part-that-counts"], ], initial = 0, widget = widgets.RadioSelect, ) # FUNCTIONS def creating_session(subsession): session = subsession.session for player in subsession.get_players(): participant = player.participant participant.part_number_current = 0 participant.part_number_Biology = 0 participant.part_number_Comp_Sci = 0 participant.part_number_education = 0 participant.part_number_Engineering = 0 participant.part_number_finance = 0 participant.part_number_Health = 0 participant.part_number_hist_geo = 0 participant.part_number_literature = 0 participant.part_number_nature_forestry_conservation = 0 participant.part_number_Psych_Cogn = 0 participant.part_number_verbal = 0 participant.part_number_vocal_technical = 0 # PAGES class consent(Page): pass class ResultsWaitPage(WaitPage): pass class Results(Page): pass class overview(Page): form_model = 'player' form_fields = ['understand1', 'understand2', 'fullatt'] # this means player.name, player.age def fullatt_error_message(player, fullatt): value1 = "I will complete this 20-minute study with my full attention." value2 = 'testing' # print('value is', value) if (value1 != fullatt) & (value2 != fullatt): return "Please only proceed if you are willing to dedicate your full attention to the tasks of this study." def understand1_error_message(player, understand1): if understand1 < 3: return "This answer is not correct. Please read through the questions and answers carefully and try again." def understand2_error_message(player, understand2): if understand2 < 3: return "This answer is not correct. Please read through the questions and answers carefully and try again." class instructions_quiz(Page): pass page_sequence = [consent, overview]