from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import math class Survey1(Page): form_model = 'player' form_fields = ['understood_mech'] class Survey2(Page): form_model = 'player' form_fields = ['manip_bid'] class Survey3(Page): form_model = 'player' form_fields = ['manip_pref'] class Survey4(Page): form_model = 'player' form_fields = ['fair_open', 'efficient_open'] class Survey5(Page): form_model = 'player' form_fields = ['fair_likert', 'efficient_likert'] class Survey6(Page): form_model = 'player' form_fields = ['experience_sowi'] class Survey7(Page): form_model = 'player' form_fields = ['logcap_baseball'] class Survey8(Page): form_model = 'player' form_fields = ['logcap_machines'] class Survey9(Page): form_model = 'player' form_fields = ['logcap_roses'] class Survey10(Page): form_model = 'player' form_fields = ['part_age', 'part_sex', 'part_program', 'part_degree', 'part_semester'] class Results(Page): # METHOD: =================================================================================== # # CREATE VARIABLES TO DISPLAY ON RESULTS.HTML =============================================== # # =========================================================================================== # def vars_for_template(self): indices = [j for j in range(1, 7)] capacities = [4, 4, 4, 7, 7, 7] valuations = [i for i in self.participant.vars['valuations']] player_bids = [i for i in self.participant.vars['player_bids']] player_prefs = [i for i in self.participant.vars['player_prefs']] successful = [i for i in self.participant.vars['successful']] clearing_bids = [i for i in self.session.vars['clearing_bids']] payoff_ram = self.participant.vars['payoff_ram'] option_to_pay = self.player.participant.vars['mpl_option_to_pay'] index_to_pay = self.player.participant.vars['mpl_index_to_pay'] payoff_mpl = self.player.participant.vars['mpl_payoff'] payoff_all = payoff_mpl + payoff_ram payoff_ceiled = math.ceil((payoff_all / 40) * 10) / 10 return { 'indices': indices, 'capacities': capacities, 'player_bids': player_bids, 'player_prefs': player_prefs, 'successful': successful, 'clearing_bids': clearing_bids, 'payoff_ram': payoff_ram, 'valuations': valuations, 'option_to_pay': option_to_pay, 'index_to_pay': index_to_pay, 'payoff_mpl': payoff_mpl, 'payoff_all': payoff_all, 'payoff_ceiled': payoff_ceiled } page_sequence = [ Survey1, Survey2, Survey3, Survey4, Survey5, Survey6, Survey7, Survey8, Survey9, Survey10, Results ]