from otree.api import * doc = """ sasha diplomka """ class C(BaseConstants): NAME_IN_URL = 'advisor_intro' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Group(BaseGroup): pass class Subsession(BaseSubsession): pass class Player(BasePlayer): question1 = models.IntegerField( initial=None, widget=widgets.RadioSelect, label="What will determine the amount of money you earn at the end of this experiment?", choices= [ [0, 'My overall payoffs'], [0, 'My average payoff'], [1, 'One randomly selected round payoff'], ] ) question1_t1 = models.BooleanField( initial=None, widget=widgets.RadioSelect, label="Can clients recognize the identity of advisors?", choices= [ [False, 'Yes'], [True, 'No'], ] ) question2_t1 = models.BooleanField( initial=None, label="Can advisors recognize the identity of clients?", choices= [ [False, 'Yes'], [True, 'No'], ] ) question3_t1 = models.BooleanField( initial=None, label="What happens if client rejects the proposal?", choices= [ [False, 'Nobody will get any payoff'], [True, 'One of the other 2 payoff pairs will be realized'], [False, 'Only client receives a payoff'], ] ) question1_t2 = models.BooleanField( initial=None, label="Can clients recognize the identity of advisors?", choices= [ [True, 'Yes'], [False, 'No'], ] ) question2_t2 = models.BooleanField( initial=None, label="Can advisors recognize the identity of clients?", choices= [ [False, 'Yes'], [True, 'No'], ] ) question3_t2 = models.BooleanField( initial=None, label="What happens if client rejects the proposal?", choices= [ [False, 'Nobody will get any payoff'], [True, 'One of the other 2 payoff pairs will be realized'], [False, 'Only client receives a payoff'], ] ) question1_t3 = models.BooleanField( initial=None, label="Can clients recognize the identity of advisors?", choices= [ [True, 'Yes'], [False, 'No'], ] ) question2_t3 = models.BooleanField( initial=None, label="Can advisors recognize the identity of clients?", choices= [ [False, 'Yes'], [True, 'No'], ] ) question3_t3 = models.BooleanField( initial=None, label="What happens if client accepts proposed fee?", choices= [ [False, 'Money will be deducted from clients payoff'], [False, 'Money will be added to advisors payoff'], [True, 'Money will be deducted from clients payoff and added to advisors payoff'], ] ) question4_t3 = models.BooleanField( initial=None, label="What happens if client rejects the proposal?", choices= [ [False, 'Nobody will get any payoff'], [True, 'One of the other 2 payoff pairs will be realized'], [False, 'Only client receives a payoff'], ] ) class MainPage(Page): form_model = 'player' form_fields = ['question1'] @staticmethod def error_message(player, values): return {q: "Incorrect answer" for q, a in values.items() if not a} class TreatmentPage(Page): form_model = 'player' @staticmethod def get_form_fields(player): if player.session.config["treatment"] == 1: return ['question1_t1','question2_t1','question3_t1'] elif player.session.config["treatment"] == 2: return ['question1_t2','question2_t2','question3_t2'] elif player.session.config["treatment"] == 3: return ['question1_t3','question2_t3','question3_t3','question4_t3'] @staticmethod def error_message(player, values): return {q: "Incorrect answer" for q, a in values.items() if not a} class FirstPage(Page): form_model = 'player' page_sequence = [FirstPage, MainPage, TreatmentPage]