from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'Quiz' players_per_group = 2 num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): quiz1 = models.StringField( choices=[['1', 'Sales representative only'], ['2', 'Operations representative only'], ['3', 'Both representatives']], label='''1. Who knows the unit-price function of the Sales representative?''', widget=widgets.RadioSelect ) def quiz1_error_message(self, value): print('value is', value) if (value != '1'): return 'wrong, number ' + value + ' is not the correct answer' quiz2 = models.StringField( choices=[['1', 'The final quantity equals the quantity the Sales representative gives in the final period'], ['2', 'The final quantity equals the quantity the Operations representative gives in the final period'], ['3', 'The final quantity is randomly chosen from one of the quantities the Operations representative gives in all seven periods']], label='''2. Due to the rules of the Benchmark mechanism, how is the final quantity determined at the end of the session?''', widget=widgets.RadioSelect ) def quiz2_error_message(self, value): print('value is', value) if (value != '3'): return 'wrong, number ' + value + ' is not the correct answer' quiz3 = models.StringField( choices=[['1', 'Sales receives 12 MU, and Operations receives 18 MU'], ['2', 'Both receive 12 MU'], ['3', 'Both receive 6 MU']], widget=widgets.RadioSelect ) def quiz3_error_message(self, value): print('value is', value) if (value != '1'): return 'wrong, number ' + value + ' is not the correct answer' quiz4 = models.StringField( choices=[['1', 'The final quantity is 4 units'], ['2', 'The final quantity is 3 units'], ['3', 'The final quantity is 7 units']], label='''4. Assume that in the final round, the Sales representative bids 4 units and the Operations representative asks 3 units, due to the rules of the Double Auction coordination mechanism, how many units are finally traded at the end of the period?''', widget=widgets.RadioSelect ) def quiz4_error_message(self, value): print('value is', value) if (value != '2'): return 'wrong, number ' + value + ' is not the correct answer' quiz5 = models.StringField( choices=[['1', 'The Sales representative pays 1*1+1*2+0*2+1*3+0*3=6 MU'], ['2', 'The Sales representative pays 1*5+0*5+1*4+0*4+1*3=12 MU'], ['3', 'The Sales representative pays 5*1+4*1+3*1=12 MU']], widget=widgets.RadioSelect ) def quiz5_error_message(self, value): print('value is', value) if (value != '1'): return 'wrong, number ' + value + ' is not the correct answer' quiz6 = models.StringField( choices=[['1', 'The Operations representative receives 0 MU'], ['2', 'The Operations representative receives 6 MU'], ['3', 'The Operations representative receives 12 MU']], label='''6. Assume the final quantity, the bidding/asking offer prices, the current quantities and the price-unit functions are the same as in Question 3 and Question 5, how much payoff does Operations representative receive at the end of the period in session 3?''', widget=widgets.RadioSelect ) def quiz6_error_message(self, value): print('value is', value) if (value != '2'): return 'wrong, number ' + value + ' is not the correct answer'