from otree.api import * c = Currency author = 'Sodiq Oyedotun' doc = """ Your task is to determine the level of effort you want to exert at your job at ABC Company, doing so for 10 rounds. """ class Constants(BaseConstants): players_per_group = 3 num_rounds = 1 name_in_url = 'abcapp' jackpot = Currency(100) lecturer_one = 'Dr. Jared Koreff' lecturer_one_university = 'Trinity University' lecturer_two = 'Dr. Stephanie Miller' lecturer_two_university = 'Quinnipiac University' lecturer_three = 'Dr. Kazeem Akinyele' lecturer_three_university = 'University of Wisconsin Oshkosh' information_sheet = 'abcapp/information_sheet.html' background = 'abcapp/background.html' contract = 'abcapp/contract.html' effort_levels = 'abcapp/effort_levels.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def make_field(question, choices=list()): return models.StringField( choices=choices, label=question, widget=widgets.RadioSelect, ) class Player(BasePlayer): q1 = make_field('In each round, a higher effort level is ', [['a', 'not associated with a monetary cost to me'], ['b', 'associated with a lower monetary cost to me'], ['c', 'associated with a higher monetary cost to me']]) q2 = make_field('In each round, a higher effort level is ', [['a', 'associated with a lower probability of me achieving a higher outcome level'], ['b','associated with a higher probability of me achieving a higher outcome level'],['c','not associated with the probability of me achieving a higher outcome level']]) q3 = make_field('For each round, I will be paid', [['a','no base salary'],['b','a base salary of 1,000 Lira.'], ['c', 'a base salary of 2,000 Lira. '],['d', 'a base salary of 3,000 Lira. ']]) q4 = make_field('For each round, without considering the monetary cost of effort, if I achieve a higher outcome level', [['a', 'My pay will be higher because I will receive a higher bonus.'],['b','My pay will not be affected.'], ['c','My pay will be lower because I will receive a lower bonus.']]) q5 = make_field('For each round, without considering the monetary cost of effort, if I achieve a higher outcome level,', [['a','My pay will be higher because I will incur a lower penalty.'], ['b','My pay will not be affected.'], ['c','My pay will be lower because I will incur a higher penalty.']]) q6 = make_field('For each round, without considering the monetary cost of effort, if I achieve a higher outcome level', [['a', 'My pay will be higher because I will receive a bonus and avoid a penalty.'], ['b', 'My pay will not be affected.'], ['c', 'My pay will be lower because I will not receive a bonus and will incur a penalty.']]) # FUNCTIONS # PAGES class ConsentForm(Page): @staticmethod def is_displayed(player: Player): return player.round_number == 1 class BackgroundInformation(Page): pass class IncentiveContract1(Page): @staticmethod def is_displayed(player): return player.id_in_group == 1 class IncentiveContract2(Page): @staticmethod def is_displayed(player): return player.id_in_group == 2 class IncentiveContract3(Page): @staticmethod def is_displayed(player): return player.id_in_group == 3 class EffortLevels1(Page): @staticmethod def is_displayed(player): return player.id_in_group == 1 class EffortLevels2(Page): @staticmethod def is_displayed(player): return player.id_in_group == 2 class EffortLevels3(Page): @staticmethod def is_displayed(player): return player.id_in_group == 3 class ResultsWaitPage(WaitPage): pass class Results(Page): pass class Quiz(Page): def vars_for_template(self): player_id = self.id_in_group p1_id = None p2_id = None p3_id = None if player_id == 1: p1_id = True elif player_id == 2: p2_id = True elif player_id == 3: p3_id = True return dict( p1_id = p1_id, p2_id = p2_id, p3_id = p3_id ) @staticmethod def error_message(player, values): if values['q1'] != 'c': return 'Your response to question 1 is incorrect. Please try again' if values['q2'] != 'b': return 'Your response to question 2 is incorrect. Please try again' id = player.id_in_group if id == 1 and values['q3'] != 'b': return 'Your response to question 3 is incorrect. Please try again' if id == 2 and values['q3'] != 'd': return 'Your response to question 3 is incorrect. Please try again' if id == 3 and values['q3'] != 'c': return 'Your response to question 3 is incorrect. Please try again' if id == 1 and values['q4'] != 'a': return 'Your response to the last question is incorrect. Please try again' if id == 2 and values['q5'] != 'a': return 'Your response to the last question is incorrect. Please try again' if id == 3 and values['q6'] != 'a': return 'Your response to the last question is incorrect. Please try again' form_model = 'player' def get_form_fields(self): if self.id_in_group== 1: return ['q1', 'q2', 'q3', 'q4'] elif self.id_in_group == 2: return ['q1', 'q2', 'q3', 'q5'] else: return ['q1', 'q2', 'q3', 'q6'] page_sequence = [ ConsentForm, BackgroundInformation, IncentiveContract1, IncentiveContract2, IncentiveContract3, EffortLevels1, EffortLevels2, EffortLevels3, Quiz, ]