from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'debriefing_new' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 CORRECT_CONF1 = 1 CORRECT_CONF2 = 1 CORRECT_CONF3 = 0 CORRECT_CONF4 = 1 CORRECT_CONF5 = 1 CORRECT_CONF6 = 0 CORRECT_CONF7 = 0 CORRECT_CONF8 = 1 CORRECT_CONF9 = 0 CORRECT_CONF10 = 0 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): Riskpreferences = models.IntegerField(min=0, max=100, label='') Overconfidence1 = models.IntegerField( choices=[ [0, '51'], [1, '39'], ], label= "What was Martin Luther King's age at death?", widget=widgets.RadioSelectHorizontal ) Overconfidence2 = models.IntegerField( choices=[ [0, '21,305 km'], [1, '6,737 km'], ], label='What is the length of the Nile river?', widget=widgets.RadioSelectHorizontal ) Overconfidence3 = models.IntegerField( choices=[ [0, '13'], [1, '17'], ], label='How many countries are members of OPEC?', widget=widgets.RadioSelectHorizontal ) Overconfidence4 = models.IntegerField( choices=[ [0, '23'], [1, '39'], ], label='How many books does the Old Testament consist of?', widget=widgets.RadioSelectHorizontal ) Overconfidence5 = models.IntegerField( choices=[ [0, '5,872 km'], [1, '3,475 km'], ], label='What is the diameter of the moon?', widget=widgets.RadioSelectHorizontal ) Overconfidence6 = models.IntegerField( choices=[ [0, '176,904 kg'], [1, '312,993 kg'], ], label='What is the weight of an empty Boeing 747?', widget=widgets.RadioSelectHorizontal ) Overconfidence7 = models.IntegerField( choices=[ [0, '1756'], [1, '1699'], ], label='Which year was Wolfgang Amadeus Mozart born in?', widget=widgets.RadioSelectHorizontal ) Overconfidence8 = models.IntegerField( choices=[ [0, '14 months '], [1, '22 months'], ], label='What is the gestation period (in months) of an Asian elephant?', widget=widgets.RadioSelectHorizontal ) Overconfidence9 = models.IntegerField( choices=[ [0, '9,588 km '], [1, '12,530 km'], ], label='What is the air distance between London and Tokyo?', widget=widgets.RadioSelectHorizontal ) Overconfidence10 = models.IntegerField( choices=[ [0, '11,033 km '], [1, '4,521 km'], ], label='What is the deepest recorded point in the oceans?', widget=widgets.RadioSelectHorizontal ) Confidence1_correct = models.IntegerField() Confidence2_correct = models.IntegerField() Confidence3_correct = models.IntegerField() Confidence4_correct = models.IntegerField() Confidence5_correct = models.IntegerField() Confidence6_correct = models.IntegerField() Confidence7_correct = models.IntegerField() Confidence8_correct = models.IntegerField() Confidence9_correct = models.IntegerField() Confidence10_correct = models.IntegerField() total = models.IntegerField() def set_payoff1(player): if C.CORRECT_CONF1 == player.Overconfidence1: player.Confidence1_correct = 1 if not C.CORRECT_CONF1 == player.Overconfidence1: player.Confidence1_correct = 0 def set_payoff2(player): if C.CORRECT_CONF2 == player.Overconfidence2: player.Confidence2_correct = 1 if not C.CORRECT_CONF2 == player.Overconfidence2: player.Confidence2_correct = 0 def set_payoff3(player): if C.CORRECT_CONF3 == player.Overconfidence3: player.Confidence3_correct = 1 if not C.CORRECT_CONF3 == player.Overconfidence3: player.Confidence3_correct = 0 def set_payoff4(player): if C.CORRECT_CONF4 == player.Overconfidence4: player.Confidence4_correct = 1 if not C.CORRECT_CONF4 == player.Overconfidence4: player.Confidence4_correct = 0 def set_payoff5(player): if C.CORRECT_CONF5 == player.Overconfidence5: player.Confidence5_correct = 1 if not C.CORRECT_CONF5 == player.Overconfidence5: player.Confidence5_correct = 0 def set_payoff6(player): if C.CORRECT_CONF6 == player.Overconfidence6: player.Confidence6_correct = 1 if not C.CORRECT_CONF6 == player.Overconfidence6: player.Confidence6_correct = 0 def set_payoff7(player): if C.CORRECT_CONF7 == player.Overconfidence7: player.Confidence7_correct = 1 if not C.CORRECT_CONF7 == player.Overconfidence7: player.Confidence7_correct = 0 def set_payoff8(player): if C.CORRECT_CONF8 == player.Overconfidence8: player.Confidence8_correct = 1 if not C.CORRECT_CONF8 == player.Overconfidence8: player.Confidence8_correct = 0 def set_payoff9(player): if C.CORRECT_CONF9 == player.Overconfidence9: player.Confidence9_correct = 1 if not C.CORRECT_CONF9 == player.Overconfidence9: player.Confidence9_correct = 0 def set_payoff10(player): if C.CORRECT_CONF10 == player.Overconfidence10: player.Confidence10_correct = 1 if not C.CORRECT_CONF10 == player.Overconfidence10: player.Confidence10_correct = 0 def set_payoff_total(player): player.total = (player.Confidence1_correct + player.Confidence2_correct + player.Confidence3_correct + player.Confidence4_correct + player.Confidence5_correct + player.Confidence6_correct + player.Confidence7_correct + player.Confidence8_correct + player.Confidence9_correct + player.Confidence10_correct) Overconfidence11 = models.IntegerField(min=0, max=10,label='How many of the 10 questions above do you think you answered correctly?') DemandP = models.StringField(label='Please guess what is our main research question', blank=True ) AttributionP1 = models.IntegerField(label='Which task did you find more difficult?', choices=[ [1, 'Additions Task'], [2, 'Puzzles Task'], [3, 'Equally both'], ] ) AttributionP2 = models.IntegerField(label='What do you think is more important to perform well in Additions Task?', choices=[ [1, 'Mainly effort'], [2, 'Mainly ability'], [3, 'Equally both'], ] ) AttributionP3 = models.IntegerField(label='What do you think is more important to perform well in Puzzles Task?', choices=[ [1, 'Mainly effort'], [2, 'Mainly ability'], [3, 'Equally both'], ] ) AttributionP4 = models.IntegerField(label='As compared to others, which task do you think you are better at?', choices=[ [1, 'Additions Task'], [2, 'Puzzles Task'], [3, 'Equally both'], ] ) # PAGES class End_task2(Page): pass class questionnaire1(Page): form_model = 'player' form_fields = ['Riskpreferences'] class questionnaire2(Page): form_model = 'player' form_fields = ['Overconfidence1', 'Overconfidence2', 'Overconfidence3', 'Overconfidence4', 'Overconfidence5', 'Overconfidence6', 'Overconfidence7', 'Overconfidence8', 'Overconfidence9', 'Overconfidence10', 'Overconfidence11'] timeout_seconds = 60 @staticmethod def before_next_page(player: Player, timeout_happened): player.set_payoff1() player.set_payoff2() player.set_payoff3() player.set_payoff4() player.set_payoff5() player.set_payoff6() player.set_payoff7() player.set_payoff8() player.set_payoff9() player.set_payoff10() player.set_payoff_total() class questionnaire3P (Page): form_model = 'player' form_fields = ['DemandP','AttributionP1','AttributionP2','AttributionP3','AttributionP4'] class End_page (Page): @staticmethod def before_next_page(player, timeout_happened): player.participant.finished = True page_sequence = [End_task2, questionnaire1, questionnaire2, questionnaire3P, End_page ]