from otree.api import * import os c = cu class C(BaseConstants): NAME_IN_URL = 'Information_Acquisition' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 APPROVAL_CAP = 6 BASE_SALARY = 1000 ACTUAL_COST = 5 UNITS = 1000 POINTS_CUSTOM_NAME = 'dimra' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): consent = models.IntegerField() prolific_id = models.StringField(default=str(" ")) quiz_q1 = models.BooleanField(blank=True, choices=[[True, 'True'], [False, 'False']], label='I will get more information before submitting the estimate.') quiz_q2 = models.BooleanField(blank=True, choices=[[True, 'True'], [False, 'False']], label='In addition to the base pay, you also keep the difference between the funds received and the actual cost.') budget = models.IntegerField(label='Please submit your budget unit cost:', max=8, min=0) peq1 = models.IntegerField() peq2 = models.IntegerField() peq3 = models.IntegerField() peq4 = models.IntegerField() peq5 = models.IntegerField() peq6 = models.IntegerField() peq7 = models.IntegerField() age = models.IntegerField(label='1.What is your age? ', max=100, min=18) gender = models.IntegerField(choices=[[1, 'Male'], [2, 'Female'], [3, 'Other'], [4, 'Prefer not to say']], label='2. Your gender:') english = models.BooleanField(choices=[[True, 'Yes'], [False, 'No']], label='3. Are you a native English speaker? ') workexperience = models.IntegerField(label='4.How many years of full-time work experience do you have? ') aifrequency = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], label='5. How often do you use AI on a daily basis? 1: not at all; 7: very much', widget=widgets.RadioSelectHorizontal) class Background(Page): form_model = 'player' @staticmethod def before_next_page(self, timeout_happened): self.prolific_id = self.participant.label pass class GeneralInfo(Page): form_model = 'player' def quiz_q1_error_message(player: Player, value): if value is not True: return "You will get more information before submitting the estimate." def quiz_q2_error_message(player: Player, value): if value is not True: return " In addition to the base pay, you also keep the difference betweenthe funds received and the actual cost." class Instruction_Manager(Page): form_model = 'player' class Quiz(Page): form_model = 'player' form_fields = ['quiz_q1', 'quiz_q2'] class InformationAcquisition(Page): form_model = 'player' class CostReporting(Page): form_model = 'player' form_fields = ['budget'] @staticmethod def before_next_page(player, timeout_happened): # compute and assign payoff player.payoff = (player.budget - 5) * 1000 + 1000 class PEQ(Page): form_model = 'player' form_fields = ['peq1','peq2','age', 'gender', 'english', 'workexperience', 'aifrequency'] preserve_unsubmitted_inputs = True class StudyEnd(Page): form_model = 'player' @staticmethod def vars_for_template(player: Player): total_payment = player.participant.payoff_plus_participation_fee() return dict( payoff=player.payoff, total_payment=total_payment, ) @staticmethod def js_vars(player): return dict( completionlink= player.subsession.session.config['completionlink'] ) pass class consent(Page): form_model = 'player' form_fields = ['consent'] class donotconsent(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.consent == 2 # page_sequence = [consent,donotconsnet,Instruction_Manager, Quiz, Chat, InformationAcquisition, CostReporting, PEQ] page_sequence = [consent,donotconsent, GeneralInfo,Background,Instruction_Manager, Quiz, InformationAcquisition, CostReporting, PEQ, StudyEnd]