from otree.api import * c = cu doc = '' class C(BaseConstants): NAME_IN_URL = 'PEQ_Unin_Full' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 TEMPLATE_TEMPLATE = 'PEQ_Unin_Full/template.html' DATA_RETRIEVE_TEMPLATE = 'PEQ_Unin_Full/data_retrieve.html' FINAL_RESULT_TEMPLATE = 'PEQ_Unin_Full/final_result.html' PAYMENT_INFO_TEMPLATE = 'PEQ_Unin_Full/payment_info.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): Round_1_Payoff = models.FloatField() Round_2_Payoff = models.FloatField() Round_3_Payoff = models.FloatField() Round_4_Payoff = models.FloatField() Round_5_Payoff = models.FloatField() Total_Payoff = models.FloatField() Final_Payoff_Dollar = models.IntegerField() Individual_Rank = models.IntegerField() Previous_Role = models.StringField() PEQ_1_Buyer = models.IntegerField(choices=[[1, 'The amount of the winning bid'], [2, 'The asset’s final value']], label='The Owners were paid based on', widget=widgets.RadioSelect) PEQ_2_Buyer = models.IntegerField(choices=[[1, "Yes, the screen specifically detailed the accuracy of each Owner's past predictions. "], [2, "No, the screen did not specifically detail the accuracy of each Owner's past predictions"], [3, 'I do not recall']], label='On the screen where you entered how much you wanted to bid on each asset, do you recall seeing information that specifically detailed the accuracy of each Owner’s past predictions', widget=widgets.RadioSelect) PEQ_3_Buyer = models.IntegerField(label="In general, I felt the Owners' predictions were intended to benefit (Based on the scale above, please input any number between 0 and 100)", max=100, min=0) PEQ_4_1_Buyer = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 1: The Owners’ choice to intentionally make favorable predications so that the asset would appear more valuable ') PEQ_4_2_Buyer = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 2: Unfavorable outcomes related to the Bonus Factor') PEQ_4_3_Buyer = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 3: Unfavorable outcomes related to the Random Factor') PEQ_4_4_Buyer = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 4: The Owners’ personal inability to perform the calculations necessary to come up with an accurate prediction ') PEQ_4_5_Buyer = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 5: The nature of the experimental task made it difficult for the Owners to perform the calculations necessary to come up with an accurate prediction ') PEQ_5_Buyer = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='I considered the relative accuracy of each Owner’s prediction (compared to other Owners) when bidding on the assets', widget=widgets.RadioSelect) PEQ_6_Buyer = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='In general, Owners’ predictions were accurate', widget=widgets.RadioSelect) PEQ_7_Buyer = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='I was provided with enough information to evaluate whether the Owners were making predictions to serve their own interest', widget=widgets.RadioSelect) PEQ_8_Buyer = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='The accuracy of the Owners’ predictions affected whether I thought their predictions were made to serve their own interest', widget=widgets.RadioSelect) PEQ_1_Owner = models.IntegerField(choices=[[1, 'The amount of the winning bid'], [2, 'The asset’s final value']], label='You were paid based on', widget=widgets.RadioSelect) PEQ_2_Owner = models.IntegerField(choices=[[1, 'Yes, the screen specifically detailed the accuracy of my past predictions. '], [2, 'No, the screen did not specifically detail the accuracy of my past predictions.'], [3, 'I do not recall']], label='On the screen where you made your choice and your prediction, do you recall seeing information that specifically detailed the accuracy of your past predictions', widget=widgets.RadioSelect) PEQ_3_Owner = models.IntegerField(label='In general, I felt my predictions were intended to benefit (Based on the scale above, please input any number between 0 and 100)', max=100, min=0) PEQ_4_1_Owner = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 1: My choice to intentionally make favorable predications so that the asset would appear more valuable ') PEQ_4_2_Owner = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 2: Unfavorable outcomes related to the Bonus Factor') PEQ_4_3_Owner = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 3:\tUnfavorable outcomes related to the Random Factor') PEQ_4_4_Owner = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 4: My personal inability to perform the calculations necessary to come up with an accurate prediction ') PEQ_4_5_Owner = models.IntegerField(choices=[[1, '1 - Largest effect on differences between predictions and actual changes in value'], [2, '2'], [3, '3'], [4, '4'], [5, '5 - Smallest effect on differences between predictions and actual changes in value']], label='Factor 5: The nature of the experimental task made it difficult for me to perform the calculations necessary to come up with an accurate prediction ') PEQ_5_Owner = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='I chose higher likelihoods of the Bonus Factor so that my predictions would be more accurate', widget=widgets.RadioSelect) PEQ_6_Owner = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='I chose likelihoods for the Bonus Factor that helped to maximize asset value', widget=widgets.RadioSelect) PEQ_7_Owner = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='I considered the relative accuracy of my predictions (compared to other Owners) when making predictions', widget=widgets.RadioSelect) PEQ_8_Owner = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='In general, my predictions were accurate', widget=widgets.RadioSelect) PEQ_9_Owner = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='The Buyers were provided with enough information to evaluate whether I was making predictions to serve my own interest', widget=widgets.RadioSelect) PEQ_10_Owner = models.IntegerField(choices=[[1, '1 (Strongly Disagree)'], [2, '2 (Disagree)'], [3, '3 (Somewhat Disagree)'], [4, '4 (Neither Agree nor Disagree)'], [5, '5 (Somewhat Agree)'], [6, '6 (Agree)'], [7, '7 (Strongly Agree)']], label='The accuracy of my predictions affected whether the Buyers thought I was making predictions to serve my own interest', widget=widgets.RadioSelect) Gender = models.IntegerField(choices=[[1, 'Male'], [2, 'Female'], [3, 'Other'], [4, 'Prefer not to answer']], label='What is your gender', widget=widgets.RadioSelect) Age = models.IntegerField(label='What is your age') English = models.IntegerField(choices=[[1, 'YES'], [2, 'NO']], label='Are you a native English speaker', widget=widgets.RadioSelect) English_2 = models.StringField(blank=True, label='If you are not a native English speaker, what is your native language') Major = models.LongStringField(label='What is your major?') Payment_Method = models.IntegerField(choices=[[1, 'Venmo'], [2, 'PayPal']], label='What is your preferred payment method') Full_Name = models.LongStringField(label='What is your full name') Student_ID = models.LongStringField(label='What is your student ID? (e.g. 2346****)') Net_ID = models.LongStringField(label='What is your Net ID? (e.g. davidsmith2)') Address = models.LongStringField(label='What is your mailing address') Email = models.LongStringField(label='What is your university email address') Venmo_Username = models.LongStringField(blank=True, label='What is your Venmo username (if you selected Venmo as your payment method above)') US = models.IntegerField(choices=[[1, 'YES'], [2, 'NO']], label='Are you a U.S. citizen or a permanent resident (for tax purposes)') PEQ4_Check_Buyer = models.IntegerField() PEQ4_Check_Owner = models.IntegerField() Risk = models.IntegerField(choices=[[1, '1 (Strongly Unlikely)'], [2, '2 (Unlikely)'], [3, '3 (Somewhat Unlikely)'], [4, '4 (Neither Likely nor Unlikely)'], [5, '5 (Somewhat Likely)'], [6, '6 (Likely)'], [7, '7 (Strongly Likely)']], label='How likely are you to take risks, in general', widget=widgets.RadioSelect) Unique_Code = models.LongStringField() Paypal_Username = models.LongStringField(blank=True, label='What is your PayPal username (if you selected PayPal as your payment method above)') def retrieve_data(player: Player): participant = player.participant player.Round_1_Payoff = participant.vars["r1_payoff"] player.Round_2_Payoff = participant.vars["r2_payoff"] player.Round_3_Payoff = participant.vars["r3_payoff"] player.Round_4_Payoff = participant.vars["r4_payoff"] player.Round_5_Payoff = participant.vars["r5_payoff"] player.Total_Payoff = player.Round_1_Payoff + player.Round_2_Payoff + player.Round_3_Payoff + player.Round_4_Payoff + player.Round_5_Payoff player.Final_Payoff_Dollar = participant.vars["total_payoff_dollar"] player.Individual_Rank = participant.vars["ranking"] player.Previous_Role = participant.vars["common_role"] def peq_check_buyer(player: Player): Total = player.PEQ_4_1_Buyer + player.PEQ_4_2_Buyer + player.PEQ_4_3_Buyer + player.PEQ_4_4_Buyer + player.PEQ_4_5_Buyer if Total == 15: player.PEQ4_Check_Buyer = 1 else: player.PEQ4_Check_Buyer = 0 def peq_check_owner(player: Player): Total = player.PEQ_4_1_Owner + player.PEQ_4_2_Owner + player.PEQ_4_3_Owner + player.PEQ_4_4_Owner + player.PEQ_4_5_Owner if Total == 15: player.PEQ4_Check_Owner = 1 else: player.PEQ4_Check_Owner = 0 def generate_unique_code(player: Player): import random unique_code = random.randint(1, 99999999) player.Unique_Code = str(unique_code) Player.retrieve_data = retrieve_data Player.peq_check_buyer = peq_check_buyer Player.peq_check_owner = peq_check_owner Player.generate_unique_code = generate_unique_code class Data_Retrieving_Page(Page): form_model = 'player' @staticmethod def before_next_page(player: Player, timeout_happened): player.retrieve_data() class PEQ_1_B(Page): form_model = 'player' form_fields = ['PEQ_1_Buyer', 'PEQ_2_Buyer'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Buyer' class PEQ_2_B(Page): form_model = 'player' form_fields = ['PEQ_3_Buyer'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Buyer' class PEQ_3_1_B(Page): form_model = 'player' form_fields = ['PEQ_4_1_Buyer', 'PEQ_4_2_Buyer', 'PEQ_4_3_Buyer', 'PEQ_4_4_Buyer', 'PEQ_4_5_Buyer'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Buyer' @staticmethod def before_next_page(player: Player, timeout_happened): player.peq_check_buyer() class PEQ_3_2_B(Page): form_model = 'player' form_fields = ['PEQ_4_1_Buyer', 'PEQ_4_2_Buyer', 'PEQ_4_3_Buyer', 'PEQ_4_4_Buyer', 'PEQ_4_5_Buyer'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Buyer' and player.PEQ4_Check_Buyer == 0 @staticmethod def before_next_page(player: Player, timeout_happened): player.peq_check_buyer() class PEQ_3_3_B(Page): form_model = 'player' form_fields = ['PEQ_4_1_Buyer', 'PEQ_4_2_Buyer', 'PEQ_4_3_Buyer', 'PEQ_4_4_Buyer', 'PEQ_4_5_Buyer'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Buyer' and player.PEQ4_Check_Buyer == 0 @staticmethod def before_next_page(player: Player, timeout_happened): player.peq_check_buyer() class PEQ_4_B(Page): form_model = 'player' form_fields = ['PEQ_5_Buyer', 'PEQ_6_Buyer', 'PEQ_7_Buyer', 'PEQ_8_Buyer'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Buyer' class PEQ_1_O(Page): form_model = 'player' form_fields = ['PEQ_1_Owner', 'PEQ_2_Owner'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Owner' class PEQ_2_O(Page): form_model = 'player' form_fields = ['PEQ_3_Owner'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Owner' class PEQ_3_1_O(Page): form_model = 'player' form_fields = ['PEQ_4_1_Owner', 'PEQ_4_2_Owner', 'PEQ_4_3_Owner', 'PEQ_4_4_Owner', 'PEQ_4_5_Owner'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Owner' @staticmethod def before_next_page(player: Player, timeout_happened): player.peq_check_owner() class PEQ_3_2_O(Page): form_model = 'player' form_fields = ['PEQ_4_1_Owner', 'PEQ_4_2_Owner', 'PEQ_4_3_Owner', 'PEQ_4_4_Owner', 'PEQ_4_5_Owner'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Owner' and player.PEQ4_Check_Owner == 0 @staticmethod def before_next_page(player: Player, timeout_happened): player.peq_check_owner() class PEQ_3_3_O(Page): form_model = 'player' form_fields = ['PEQ_4_1_Owner', 'PEQ_4_2_Owner', 'PEQ_4_3_Owner', 'PEQ_4_4_Owner', 'PEQ_4_5_Owner'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Owner' and player.PEQ4_Check_Owner == 0 @staticmethod def before_next_page(player: Player, timeout_happened): player.peq_check_owner() class PEQ_4_O(Page): form_model = 'player' form_fields = ['PEQ_5_Owner', 'PEQ_6_Owner', 'PEQ_7_Owner', 'PEQ_8_Owner', 'PEQ_9_Owner', 'PEQ_10_Owner'] @staticmethod def is_displayed(player: Player): return player.Previous_Role == 'Owner' class Demo(Page): form_model = 'player' form_fields = ['Risk', 'Gender', 'Age', 'English', 'English_2', 'Major'] class Final_Results(Page): form_model = 'player' @staticmethod def before_next_page(player: Player, timeout_happened): player.generate_unique_code() class Payment(Page): form_model = 'player' form_fields = ['Full_Name', 'Student_ID', 'Email', 'Payment_Method', 'Venmo_Username', 'Paypal_Username'] class Final_Page(Page): form_model = 'player' page_sequence = [Data_Retrieving_Page, PEQ_1_B, PEQ_2_B, PEQ_3_1_B, PEQ_3_2_B, PEQ_3_3_B, PEQ_4_B, PEQ_1_O, PEQ_2_O, PEQ_3_1_O, PEQ_3_2_O, PEQ_3_3_O, PEQ_4_O, Demo, Final_Results, Payment, Final_Page]