from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import itertools author = 'Zeyu Qiu' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'framing' players_per_group = 4 num_rounds = 1 # """Amount allocated to each player""" multiplier = 0.4 pounds = 0.02 fixed = 1.10 def set_scale_choices_list(length): choices_list = [] for i in range(length): choices_list.append((i + 1, str(i + 1))) return choices_list def make_scale_field(label_string, length): return models.IntegerField( choices=set_scale_choices_list(length), widget=widgets.RadioSelectHorizontal, label=label_string # blank=True ) class Subsession(BaseSubsession): def creating_session(self): # treatments for p in self.get_groups(): if p.id_in_subsession: pressures = itertools.cycle([0,1,2,3]) for player in self.get_groups(): player.code_treatment = next(pressures) if p.code_treatment == 0: p.treatment = "equalpro" elif p.code_treatment == 1: p.treatment = "equalmain" elif p.code_treatment == 2: p.treatment = "unequalpro" else: p.treatment = "unequalmain" #for p in self.get_groups(): #if p.id_in_subsession: #treatment_rand = random.random() #if treatment_rand > 0.5: #p.treatment = "equal" #else: #p.treatment = "unequal" # treatment in player section for p in self.get_players(): p.treatment = p.group.treatment # roles and endowment for p in self.get_players(): if p.treatment: if p.treatment == "unequalpro" or p.treatment == "unequalmain": if p.id_in_group == 1: p.your_type = "high" elif p.id_in_group ==2: p.your_type = "low" elif p.id_in_group == 3: p.your_type = "low" else: p.your_type = "high" else: p.your_type = "neutral" for p in self.get_players(): if p.your_type == "low" and p.treatment == "unequalpro": p.my_endowment = 10 p.other_endowment = 10 p.others_endowment = 30 elif p.your_type == "high" and p.treatment == "unequalpro": p.my_endowment = 30 p.other_endowment = 30 p.others_endowment = 10 elif p.your_type == "neutral" and p.treatment == "equalpro": p.my_endowment = 20 p.other_endowment = 20 elif p.your_type == "low" and p.treatment == "unequalmain": p.my_withdrawal_max = 10 p.other_withdrawal_max = 10 p.others_withdrawal_max = 30 elif p.your_type == "high" and p.treatment == "unequalmain": p.my_withdrawal_max = 30 p.other_withdrawal_max = 30 p.others_withdrawal_max = 10 elif p.your_type == "neutral" and p.treatment == "equalmain": p.my_withdrawal_max = 20 p.other_withdrawal_max = 20 # prolific ID for p in self.get_players(): p.Prolific_ID = p.participant.label class Group(BaseGroup): treatment = models.StringField() code_treatment = models.IntegerField() total_contribution = models.IntegerField() individual_share = models.FloatField() total_contribution_estimate = models.IntegerField() class Player(BasePlayer): Prolific_ID = models.StringField( label="Prolific ID", ) your_type = models.StringField() my_endowment = models.IntegerField() other_endowment = models.IntegerField() others_endowment = models.IntegerField() my_withdrawal_max = models.IntegerField() other_withdrawal_max = models.IntegerField() others_withdrawal_max = models.IntegerField() treatment = models.StringField() my_withdrawal_max = models.IntegerField() other_withdrawal_max = models.IntegerField() ################################################ contribution1 = models.IntegerField( label="Please now enter your unconditional contribution decision:", min= 0, ) withdrawal1 = models.IntegerField( label="Please now enter your unconditional withdrawal decision", min= 0, ) def contribution1_error_message(self, value): contribution1_answer = self.my_endowment if value > contribution1_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message def withdrawal1_error_message(self, value): withdrawal1_answer = self.my_withdrawal_max if value > withdrawal1_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message ################################################ con_contribution_0token = models.IntegerField( label="", min=0, ) def con_contribution_0token_error_message(self, value): con_contribution_0token_answer = self.my_endowment if value > con_contribution_0token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_1token = models.IntegerField( label="", min=0, ) def con_contribution_1token_error_message(self, value): con_contribution_1token_answer = self.my_endowment if value > con_contribution_1token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_2token = models.IntegerField( label="", min=0, ) def con_contribution_2token_error_message(self, value): con_contribution_2token_answer = self.my_endowment if value > con_contribution_2token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_3token = models.IntegerField( label="", min=0, ) def con_contribution_3token_error_message(self, value): con_contribution_3token_answer = self.my_endowment if value > con_contribution_3token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_4token = models.IntegerField( label="", min=0, ) def con_contribution_4token_error_message(self, value): con_contribution_4token_answer = self.my_endowment if value > con_contribution_4token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_5token = models.IntegerField( label="", min=0, ) def con_contribution_5token_error_message(self, value): con_contribution_5token_answer = self.my_endowment if value > con_contribution_5token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_6token = models.IntegerField( label="", min=0, ) def con_contribution_6token_error_message(self, value): con_contribution_6token_answer = self.my_endowment if value > con_contribution_6token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_7token = models.IntegerField( label="", min=0, ) def con_contribution_7token_error_message(self, value): con_contribution_7token_answer = self.my_endowment if value > con_contribution_7token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_8token = models.IntegerField( label="", min=0, ) def con_contribution_8token_error_message(self, value): con_contribution_8token_answer = self.my_endowment if value > con_contribution_8token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_9token = models.IntegerField( label="", min=0, ) def con_contribution_9token_error_message(self, value): con_contribution_9token_answer = self.my_endowment if value > con_contribution_9token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_10token = models.IntegerField( label="", min=0, ) def con_contribution_10token_error_message(self, value): con_contribution_10token_answer = self.my_endowment if value > con_contribution_10token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_11token = models.IntegerField( label="", min=0, ) def con_contribution_11token_error_message(self, value): con_contribution_11token_answer = self.my_endowment if value > con_contribution_11token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_12token = models.IntegerField( label="", min=0, ) def con_contribution_12token_error_message(self, value): con_contribution_12token_answer = self.my_endowment if value > con_contribution_12token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_13token = models.IntegerField( label="", min=0, ) def con_contribution_13token_error_message(self, value): con_contribution_13token_answer = self.my_endowment if value > con_contribution_13token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_14token = models.IntegerField( label="", min=0, ) def con_contribution_14token_error_message(self, value): con_contribution_14token_answer = self.my_endowment if value > con_contribution_14token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_15token = models.IntegerField( label="", min=0, ) def con_contribution_15token_error_message(self, value): con_contribution_15token_answer = self.my_endowment if value > con_contribution_15token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_16token = models.IntegerField( label="", min=0, ) def con_contribution_16token_error_message(self, value): con_contribution_16token_answer = self.my_endowment if value > con_contribution_16token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_17token = models.IntegerField( label="", min=0, ) def con_contribution_17token_error_message(self, value): con_contribution_17token_answer = self.my_endowment if value > con_contribution_17token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_18token = models.IntegerField( label="", min=0, ) def con_contribution_18token_error_message(self, value): con_contribution_18token_answer = self.my_endowment if value > con_contribution_18token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_19token = models.IntegerField( label="", min=0, ) def con_contribution_19token_error_message(self, value): con_contribution_19token_answer = self.my_endowment if value > con_contribution_19token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_20token = models.IntegerField( label="", min=0, ) def con_contribution_20token_error_message(self, value): con_contribution_20token_answer = self.my_endowment if value > con_contribution_20token_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_0token_low = models.IntegerField( label="", min=0, ) def con_contribution_0token_low_error_message(self, value): con_contribution_0token_low_answer = self.my_endowment if value > con_contribution_0token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_1token_low = models.IntegerField( label="", min=0, ) def con_contribution_1token_low_error_message(self, value): con_contribution_1token_low_answer = self.my_endowment if value > con_contribution_1token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_2token_low = models.IntegerField( label="", min=0, ) def con_contribution_2token_low_error_message(self, value): con_contribution_2token_low_answer = self.my_endowment if value > con_contribution_2token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_3token_low = models.IntegerField( label="", min=0, ) def con_contribution_3token_low_error_message(self, value): con_contribution_3token_low_answer = self.my_endowment if value > con_contribution_3token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_4token_low = models.IntegerField( label="", min=0, ) def con_contribution_4token_low_error_message(self, value): con_contribution_4token_low_answer = self.my_endowment if value > con_contribution_4token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_5token_low = models.IntegerField( label="", min=0, ) def con_contribution_5token_low_error_message(self, value): con_contribution_5token_low_answer = self.my_endowment if value > con_contribution_5token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_6token_low = models.IntegerField( label="", min=0, ) def con_contribution_6token_low_error_message(self, value): con_contribution_6token_low_answer = self.my_endowment if value > con_contribution_6token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_7token_low = models.IntegerField( label="", min=0, ) def con_contribution_7token_low_error_message(self, value): con_contribution_7token_low_answer = self.my_endowment if value > con_contribution_7token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_8token_low = models.IntegerField( label="", min=0, ) def con_contribution_8token_low_error_message(self, value): con_contribution_8token_low_answer = self.my_endowment if value > con_contribution_8token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_9token_low = models.IntegerField( label="", min=0, ) def con_contribution_9token_low_error_message(self, value): con_contribution_9token_low_answer = self.my_endowment if value > con_contribution_9token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_10token_low = models.IntegerField( label="", min=0, ) def con_contribution_10token_low_error_message(self, value): con_contribution_10token_low_answer = self.my_endowment if value > con_contribution_10token_low_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_0token_high = models.IntegerField( label="", min=0, ) def con_contribution_0token_high_error_message(self, value): con_contribution_0token_high_answer = self.my_endowment if value > con_contribution_0token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_1token_high = models.IntegerField( label="", min=0, ) def con_contribution_1token_high_error_message(self, value): con_contribution_1token_high_answer = self.my_endowment if value > con_contribution_1token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_2token_high = models.IntegerField( label="", min=0, ) def con_contribution_2token_high_error_message(self, value): con_contribution_2token_high_answer = self.my_endowment if value > con_contribution_2token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_3token_high = models.IntegerField( label="", min=0, ) def con_contribution_3token_high_error_message(self, value): con_contribution_3token_high_answer = self.my_endowment if value > con_contribution_3token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_4token_high = models.IntegerField( label="", min=0, ) def con_contribution_4token_high_error_message(self, value): con_contribution_4token_high_answer = self.my_endowment if value > con_contribution_4token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_5token_high = models.IntegerField( label="", min=0, ) def con_contribution_5token_high_error_message(self, value): con_contribution_5token_high_answer = self.my_endowment if value > con_contribution_5token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_6token_high = models.IntegerField( label="", min=0, ) def con_contribution_6token_high_error_message(self, value): con_contribution_6token_high_answer = self.my_endowment if value > con_contribution_6token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_7token_high = models.IntegerField( label="", min=0, ) def con_contribution_7token_high_error_message(self, value): con_contribution_7token_high_answer = self.my_endowment if value > con_contribution_7token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_8token_high = models.IntegerField( label="", min=0, ) def con_contribution_8token_high_error_message(self, value): con_contribution_8token_high_answer = self.my_endowment if value > con_contribution_8token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_9token_high = models.IntegerField( label="", min=0, ) def con_contribution_9token_high_error_message(self, value): con_contribution_9token_high_answer = self.my_endowment if value > con_contribution_9token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_10token_high = models.IntegerField( label="", min=0, ) def con_contribution_10token_high_error_message(self, value): con_contribution_10token_high_answer = self.my_endowment if value > con_contribution_10token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_11token_high = models.IntegerField( label="", min=0, ) def con_contribution_11token_high_error_message(self, value): con_contribution_11token_high_answer = self.my_endowment if value > con_contribution_11token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_12token_high = models.IntegerField( label="", min=0, ) def con_contribution_12token_high_error_message(self, value): con_contribution_12token_high_answer = self.my_endowment if value > con_contribution_12token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_13token_high = models.IntegerField( label="", min=0, ) def con_contribution_13token_high_error_message(self, value): con_contribution_13token_high_answer = self.my_endowment if value > con_contribution_13token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_14token_high = models.IntegerField( label="", min=0, ) def con_contribution_14token_high_error_message(self, value): con_contribution_14token_high_answer = self.my_endowment if value > con_contribution_14token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_15token_high = models.IntegerField( label="", min=0, ) def con_contribution_15token_high_error_message(self, value): con_contribution_15token_high_answer = self.my_endowment if value > con_contribution_15token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_11token_high = models.IntegerField( label="", min=0, ) def con_contribution_11token_high_error_message(self, value): con_contribution_11token_high_answer = self.my_endowment if value > con_contribution_11token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_12token_high = models.IntegerField( label="", min=0, ) def con_contribution_12token_high_error_message(self, value): con_contribution_12token_high_answer = self.my_endowment if value > con_contribution_12token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_13token_high = models.IntegerField( label="", min=0, ) def con_contribution_13token_high_error_message(self, value): con_contribution_13token_high_answer = self.my_endowment if value > con_contribution_13token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_14token_high = models.IntegerField( label="", min=0, ) def con_contribution_14token_high_error_message(self, value): con_contribution_14token_high_answer = self.my_endowment if value > con_contribution_14token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_15token_high = models.IntegerField( label="", min=0, ) def con_contribution_15token_high_error_message(self, value): con_contribution_15token_high_answer = self.my_endowment if value > con_contribution_15token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_16token_high = models.IntegerField( label="", min=0, ) def con_contribution_16token_high_error_message(self, value): con_contribution_16token_high_answer = self.my_endowment if value > con_contribution_16token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_17token_high = models.IntegerField( label="", min=0, ) def con_contribution_17token_high_error_message(self, value): con_contribution_17token_high_answer = self.my_endowment if value > con_contribution_17token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_18token_high = models.IntegerField( label="", min=0, ) def con_contribution_18token_high_error_message(self, value): con_contribution_18token_high_answer = self.my_endowment if value > con_contribution_18token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_19token_high = models.IntegerField( label="", min=0, ) def con_contribution_19token_high_error_message(self, value): con_contribution_19token_high_answer = self.my_endowment if value > con_contribution_19token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_20token_high = models.IntegerField( label="", min=0, ) def con_contribution_20token_high_error_message(self, value): con_contribution_20token_high_answer = self.my_endowment if value > con_contribution_20token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_21token_high = models.IntegerField( label="", min=0, ) def con_contribution_21token_high_error_message(self, value): con_contribution_21token_high_answer = self.my_endowment if value > con_contribution_21token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_22token_high = models.IntegerField( label="", min=0, ) def con_contribution_22token_high_error_message(self, value): con_contribution_22token_high_answer = self.my_endowment if value > con_contribution_22token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_23token_high = models.IntegerField( label="", min=0, ) def con_contribution_23token_high_error_message(self, value): con_contribution_23token_high_answer = self.my_endowment if value > con_contribution_23token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_24token_high = models.IntegerField( label="", min=0, ) def con_contribution_24token_high_error_message(self, value): con_contribution_24token_high_answer = self.my_endowment if value > con_contribution_24token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_25token_high = models.IntegerField( label="", min=0, ) def con_contribution_25token_high_error_message(self, value): con_contribution_25token_high_answer = self.my_endowment if value > con_contribution_25token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_26token_high = models.IntegerField( label="", min=0, ) def con_contribution_26token_high_error_message(self, value): con_contribution_26token_high_answer = self.my_endowment if value > con_contribution_26token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_27token_high = models.IntegerField( label="", min=0, ) def con_contribution_27token_high_error_message(self, value): con_contribution_27token_high_answer = self.my_endowment if value > con_contribution_27token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_28token_high = models.IntegerField( label="", min=0, ) def con_contribution_28token_high_error_message(self, value): con_contribution_28token_high_answer = self.my_endowment if value > con_contribution_28token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_29token_high = models.IntegerField( label="", min=0, ) def con_contribution_29token_high_error_message(self, value): con_contribution_29token_high_answer = self.my_endowment if value > con_contribution_29token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_contribution_30token_high = models.IntegerField( label="", min=0, ) def con_contribution_30token_high_error_message(self, value): con_contribution_30token_high_answer = self.my_endowment if value > con_contribution_30token_high_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message con_withdrawal_0token = models.IntegerField( label="", min=0, ) def con_withdrawal_0token_error_message(self, value): con_withdrawal_0token_answer = self.my_withdrawal_max if value > con_withdrawal_0token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_1token = models.IntegerField( label="", min=0, ) def con_withdrawal_1token_error_message(self, value): con_withdrawal_1token_answer = self.my_withdrawal_max if value > con_withdrawal_1token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_2token = models.IntegerField( label="", min=0, ) def con_withdrawal_2token_error_message(self, value): con_withdrawal_2token_answer = self.my_withdrawal_max if value > con_withdrawal_2token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_3token = models.IntegerField( label="", min=0, ) def con_withdrawal_3token_error_message(self, value): con_withdrawal_3token_answer = self.my_withdrawal_max if value > con_withdrawal_3token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_4token = models.IntegerField( label="", min=0, ) def con_withdrawal_4token_error_message(self, value): con_withdrawal_4token_answer = self.my_withdrawal_max if value > con_withdrawal_4token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_5token = models.IntegerField( label="", min=0, ) def con_withdrawal_5token_error_message(self, value): con_withdrawal_5token_answer = self.my_withdrawal_max if value > con_withdrawal_5token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_6token = models.IntegerField( label="", min=0, ) def con_withdrawal_6token_error_message(self, value): con_withdrawal_6token_answer = self.my_withdrawal_max if value > con_withdrawal_6token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_7token = models.IntegerField( label="", min=0, ) def con_withdrawal_7token_error_message(self, value): con_withdrawal_7token_answer = self.my_withdrawal_max if value > con_withdrawal_7token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_8token = models.IntegerField( label="", min=0, ) def con_withdrawal_8token_error_message(self, value): con_withdrawal_8token_answer = self.my_withdrawal_max if value > con_withdrawal_8token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_9token = models.IntegerField( label="", min=0, ) def con_withdrawal_9token_error_message(self, value): con_withdrawal_9token_answer = self.my_withdrawal_max if value > con_withdrawal_9token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_10token = models.IntegerField( label="", min=0, ) def con_withdrawal_10token_error_message(self, value): con_withdrawal_10token_answer = self.my_withdrawal_max if value > con_withdrawal_10token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_11token = models.IntegerField( label="", min=0, ) def con_withdrawal_11token_error_message(self, value): con_withdrawal_11token_answer = self.my_withdrawal_max if value > con_withdrawal_11token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_12token = models.IntegerField( label="", min=0, ) def con_withdrawal_12token_error_message(self, value): con_withdrawal_12token_answer = self.my_withdrawal_max if value > con_withdrawal_12token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_13token = models.IntegerField( label="", min=0, ) def con_withdrawal_13token_error_message(self, value): con_withdrawal_13token_answer = self.my_withdrawal_max if value > con_withdrawal_13token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_14token = models.IntegerField( label="", min=0, ) def con_withdrawal_14token_error_message(self, value): con_withdrawal_14token_answer = self.my_withdrawal_max if value > con_withdrawal_14token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_15token = models.IntegerField( label="", min=0, ) def con_withdrawal_15token_error_message(self, value): con_withdrawal_15token_answer = self.my_withdrawal_max if value > con_withdrawal_15token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_16token = models.IntegerField( label="", min=0, ) def con_withdrawal_16token_error_message(self, value): con_withdrawal_16token_answer = self.my_withdrawal_max if value > con_withdrawal_16token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_17token = models.IntegerField( label="", min=0, ) def con_withdrawal_17token_error_message(self, value): con_withdrawal_17token_answer = self.my_withdrawal_max if value > con_withdrawal_17token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_18token = models.IntegerField( label="", min=0, ) def con_withdrawal_18token_error_message(self, value): con_withdrawal_18token_answer = self.my_withdrawal_max if value > con_withdrawal_18token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_19token = models.IntegerField( label="", min=0, ) def con_withdrawal_19token_error_message(self, value): con_withdrawal_19token_answer = self.my_withdrawal_max if value > con_withdrawal_19token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_20token = models.IntegerField( label="", min=0, ) def con_withdrawal_20token_error_message(self, value): con_withdrawal_20token_answer = self.my_withdrawal_max if value > con_withdrawal_20token_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_0token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_0token_low_error_message(self, value): con_withdrawal_0token_low_answer = self.my_withdrawal_max if value > con_withdrawal_0token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_1token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_1token_low_error_message(self, value): con_withdrawal_1token_low_answer = self.my_withdrawal_max if value > con_withdrawal_1token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_2token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_2token_low_error_message(self, value): con_withdrawal_2token_low_answer = self.my_withdrawal_max if value > con_withdrawal_2token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_3token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_3token_low_error_message(self, value): con_withdrawal_3token_low_answer = self.my_withdrawal_max if value > con_withdrawal_3token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_4token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_4token_low_error_message(self, value): con_withdrawal_4token_low_answer = self.my_withdrawal_max if value > con_withdrawal_4token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_5token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_5token_low_error_message(self, value): con_withdrawal_5token_low_answer = self.my_withdrawal_max if value > con_withdrawal_5token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_6token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_6token_low_error_message(self, value): con_withdrawal_6token_low_answer = self.my_withdrawal_max if value > con_withdrawal_6token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_7token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_7token_low_error_message(self, value): con_withdrawal_7token_low_answer = self.my_withdrawal_max if value > con_withdrawal_7token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_8token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_8token_low_error_message(self, value): con_withdrawal_8token_low_answer = self.my_withdrawal_max if value > con_withdrawal_8token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_9token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_9token_low_error_message(self, value): con_withdrawal_9token_low_answer = self.my_withdrawal_max if value > con_withdrawal_9token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_10token_low = models.IntegerField( label="", min=0, ) def con_withdrawal_10token_low_error_message(self, value): con_withdrawal_10token_low_answer = self.my_withdrawal_max if value > con_withdrawal_10token_low_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_0token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_0token_high_error_message(self, value): con_withdrawal_0token_high_answer = self.my_withdrawal_max if value > con_withdrawal_0token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_1token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_1token_high_error_message(self, value): con_withdrawal_1token_high_answer = self.my_withdrawal_max if value > con_withdrawal_1token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_2token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_2token_high_error_message(self, value): con_withdrawal_2token_high_answer = self.my_withdrawal_max if value > con_withdrawal_2token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_3token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_3token_high_error_message(self, value): con_withdrawal_3token_high_answer = self.my_withdrawal_max if value > con_withdrawal_3token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_4token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_4token_high_error_message(self, value): con_withdrawal_4token_high_answer = self.my_withdrawal_max if value > con_withdrawal_4token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_5token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_5token_high_error_message(self, value): con_withdrawal_5token_high_answer = self.my_withdrawal_max if value > con_withdrawal_5token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_6token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_6token_high_error_message(self, value): con_withdrawal_6token_high_answer = self.my_withdrawal_max if value > con_withdrawal_6token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_7token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_7token_high_error_message(self, value): con_withdrawal_7token_high_answer = self.my_withdrawal_max if value > con_withdrawal_7token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_8token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_8token_high_error_message(self, value): con_withdrawal_8token_high_answer = self.my_withdrawal_max if value > con_withdrawal_8token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_9token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_9token_high_error_message(self, value): con_withdrawal_9token_high_answer = self.my_withdrawal_max if value > con_withdrawal_9token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_10token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_10token_high_error_message(self, value): con_withdrawal_10token_high_answer = self.my_withdrawal_max if value > con_withdrawal_10token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_11token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_11token_high_error_message(self, value): con_withdrawal_11token_high_answer = self.my_withdrawal_max if value > con_withdrawal_11token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_12token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_12token_high_error_message(self, value): con_withdrawal_12token_high_answer = self.my_withdrawal_max if value > con_withdrawal_12token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_13token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_13token_high_error_message(self, value): con_withdrawal_13token_high_answer = self.my_withdrawal_max if value > con_withdrawal_13token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_14token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_14token_high_error_message(self, value): con_withdrawal_14token_high_answer = self.my_withdrawal_max if value > con_withdrawal_14token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_15token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_15token_high_error_message(self, value): con_withdrawal_15token_high_answer = self.my_withdrawal_max if value > con_withdrawal_15token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_16token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_16token_high_error_message(self, value): con_withdrawal_16token_high_answer = self.my_withdrawal_max if value > con_withdrawal_16token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_17token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_17token_high_error_message(self, value): con_withdrawal_17token_high_answer = self.my_withdrawal_max if value > con_withdrawal_17token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_18token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_18token_high_error_message(self, value): con_withdrawal_18token_high_answer = self.my_withdrawal_max if value > con_withdrawal_18token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_19token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_19token_high_error_message(self, value): con_withdrawal_19token_high_answer = self.my_withdrawal_max if value > con_withdrawal_19token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_20token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_20token_high_error_message(self, value): con_withdrawal_20token_high_answer = self.my_withdrawal_max if value > con_withdrawal_20token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_21token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_21token_high_error_message(self, value): con_withdrawal_21token_high_answer = self.my_withdrawal_max if value > con_withdrawal_21token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_22token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_22token_high_error_message(self, value): con_withdrawal_22token_high_answer = self.my_withdrawal_max if value > con_withdrawal_22token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_23token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_23token_high_error_message(self, value): con_withdrawal_23token_high_answer = self.my_withdrawal_max if value > con_withdrawal_23token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_24token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_24token_high_error_message(self, value): con_withdrawal_24token_high_answer = self.my_withdrawal_max if value > con_withdrawal_24token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_25token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_25token_high_error_message(self, value): con_withdrawal_25token_high_answer = self.my_withdrawal_max if value > con_withdrawal_25token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_26token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_26token_high_error_message(self, value): con_withdrawal_26token_high_answer = self.my_withdrawal_max if value > con_withdrawal_26token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_27token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_27token_high_error_message(self, value): con_withdrawal_27token_high_answer = self.my_withdrawal_max if value > con_withdrawal_27token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_28token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_28token_high_error_message(self, value): con_withdrawal_28token_high_answer = self.my_withdrawal_max if value > con_withdrawal_28token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_29token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_29token_high_error_message(self, value): con_withdrawal_29token_high_answer = self.my_withdrawal_max if value > con_withdrawal_29token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message con_withdrawal_30token_high = models.IntegerField( label="", min=0, ) def con_withdrawal_30token_high_error_message(self, value): con_withdrawal_30token_high_answer = self.my_withdrawal_max if value > con_withdrawal_30token_high_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message ################################################ contribution2 = models.IntegerField( label="Please now enter your contribution decision:", min=0, ) withdrawal2 = models.IntegerField( label="Please now enter your withdrawal decision", min=0, ) def contribution2_error_message(self, value): contribution2_answer = self.my_endowment if value > contribution2_answer: error_message = "You cannot contribute more than the number of tokens you have been allocated. " \ "Please try again." return error_message def withdrawal2_error_message(self, value): withdrawal2_answer = self.my_withdrawal_max if value > withdrawal2_answer: error_message = "You cannot withdraw more than the number of tokens you can withdraw. " \ "Please try again." return error_message estimate_equal_con = models.IntegerField( min=0, ) def estimate_equal_con_error_message(self, value): estimate_equal_con_answer = self.other_endowment if value > estimate_equal_con_answer: error_message = "You cannot estimate more than the number of tokens other group members are allocated wtih. " \ "Please try again." return error_message estimate_equal_with = models.IntegerField( min=0, ) def estimate_equal_with_error_message(self, value): estimate_equal_with_answer = self.other_withdrawal_max if value > estimate_equal_with_answer: error_message = "You cannot estimate more than the number of tokens other group members can withdraw. " \ "Please try again." return error_message estimate_other_con = models.IntegerField( min=0, ) def estimate_other_con_error_message(self, value): estimate_other_con_answer = self.other_endowment if value > estimate_other_con_answer: error_message = "You cannot estimate more than the number of tokens the other group member is allocated wtih. " \ "Please try again." return error_message estimate_other_with = models.IntegerField( min=0, ) def estimate_other_with_error_message(self, value): estimate_other_with_answer = self.other_withdrawal_max if value > estimate_other_with_answer: error_message = "You cannot estimate more than the number of tokens the other group member can withdraw. " \ "Please try again." return error_message estimate_others_con = models.IntegerField( min=0, ) def estimate_others_con_error_message(self, value): estimate_others_con_answer = self.others_endowment if value > estimate_others_con_answer: error_message = "You cannot estimate more than the number of tokens other group members are allocated wtih. " \ "Please try again." return error_message estimate_others_with = models.IntegerField( min=0, ) def estimate_others_with_error_message(self, value): estimate_others_with_answer = self.others_withdrawal_max if value > estimate_others_with_answer: error_message = "You cannot estimate more than the number of tokens other group members can withdraw. " \ "Please try again." return error_message ################################################ other_contribution = models.IntegerField() other_contribution_estimate = models.IntegerField() other_payoff = models.FloatField() bonus_earnings = models.CurrencyField() fixed_earnings = models.CurrencyField() final_earnings = models.CurrencyField() my_payoff = models.FloatField() estimate_pay = models.FloatField() ################################################ control_question = models.StringField( choices=[ ['1', 'I agree to take part. Take me to the study.'], ['2', 'I do not agree to take part in this study. Take me back to Prolific.'], ], label="Do you agree to participate in this study?", widget=widgets.RadioSelect ) def control_question_error_message(self, value): correct_answer = '1' if value != correct_answer: error_message = "If you do not agree to take part in this study, please close your browser tab." return error_message ################################################ question1 = models.IntegerField( label="", min=0, ) def question1_error_message(self, value): correct_equalpro_q1 = 20 correct_equalmain_q1 = 20 correct_unequalpro_q1 = 10 correct_unequalmain_q1 = 10 if self.treatment == 'equalpro' and value != correct_equalpro_q1: error_equalpro_q1 = "correct answer: (20 - 0) + 0.4 x 0 = 20 points" return error_equalpro_q1 elif self.treatment == 'equalmain' and value != correct_equalmain_q1: error_equalmain_q1 = "correct answer: (0+20) + 0.4 x (80-80) = 20 points" return error_equalmain_q1 elif self.treatment == 'unequalpro' and value != correct_unequalpro_q1: error_unequalpro_q1 = "correct answer: (10 - 0) + 0.4 x 0 = 10 points" return error_unequalpro_q1 elif self.treatment == 'unequalmain' and value != correct_unequalmain_q1: error_unequalmain_q1 = "correct answer: (10) + 0.4 x (80-80) = 10 points" return error_unequalmain_q1 ################################################ question2 = models.IntegerField( label="", min=0, ) def question2_error_message(self, value): correct_equalpro_q2 = 20 correct_equalmain_q2 = 20 correct_unequalpro_q2 = 10 correct_unequalmain_q2 = 10 if self.treatment == 'equalpro' and value != correct_equalpro_q2: error_equalpro_q2 = "correct answer: (20 - 0) + 0.4 x 0 = 20 points" return error_equalpro_q2 elif self.treatment == 'equalmain' and value != correct_equalmain_q2: error_equalmain_q2 = "correct answer: (0+20) + 0.4 x (80-80) = 20 points" return error_equalmain_q2 elif self.treatment == 'unequalpro' and value != correct_unequalpro_q2: error_unequalpro_q2 = "correct answer: (10 - 0) + 0.4 x 0 = 10 points" return error_unequalpro_q2 elif self.treatment == 'unequalmain' and value != correct_unequalmain_q2: error_unequalmain_q2 = "correct answer: (10) + 0.4 x (80-80) = 10 points" return error_unequalmain_q2 question3 = models.IntegerField( label="", min=0, ) def question3_error_message(self, value): correct_equalpro_q3 = 32 correct_equalmain_q3 = 32 correct_unequalpro_q3 = 32 correct_unequalmain_q3 = 32 if self.treatment == 'equalpro' and value != correct_equalpro_q3: error_equalpro_q3 = "correct answer: (20 - 20) + 0.4 x (20+20+20+20) = 32 points" return error_equalpro_q3 elif self.treatment == 'equalmain' and value != correct_equalmain_q3: error_equalmain_q3 = "correct answer: (0+0) + 0.4 x (80-0) = 32 points" return error_equalmain_q3 elif self.treatment == 'unequalpro' and value != correct_unequalpro_q3: error_unequalpro_q3 = "correct answer: (30-30) + 0.4 x (10+10+30+30) = 32 points" return error_unequalpro_q3 elif self.treatment == 'unequalmain' and value != correct_unequalmain_q3: error_unequalmain_q3 = "correct answer: (0) + 0.4 x (80) = 32 points" return error_unequalmain_q3 question4 = models.IntegerField( label="", min=0, ) def question4_error_message(self, value): correct_equalpro_q4 = 32 correct_equalmain_q4 = 32 correct_unequalpro_q4 = 32 correct_unequalmain_q4 = 32 if self.treatment == 'equalpro' and value != correct_equalpro_q4: error_equalpro_q4 = "correct answer: (20 - 20) + 0.4 x (20+20+20+20) = 32 points" return error_equalpro_q4 elif self.treatment == 'equalmain' and value != correct_equalmain_q4: error_equalmain_q4 = "correct answer: (0+0) + 0.4 x (80-0) = 32 points" return error_equalmain_q4 elif self.treatment == 'unequalpro' and value != correct_unequalpro_q4: error_unequalpro_q4 = "correct answer: (10-10) + 0.4 x (10+10+30+30) = 32 points" return error_unequalpro_q4 elif self.treatment == 'unequalmain' and value != correct_unequalmain_q4: error_unequalmain_q4 = "correct answer: (0) + 0.4 x (80) = 32 points" return error_unequalmain_q4 question5 = models.IntegerField( label="", min=0, ) def question5_error_message(self, value): correct_equalpro_q5 = 32 correct_equalmain_q5 = 32 correct_unequalpro_q5 = 42 correct_unequalmain_q5 = 42 if self.treatment == 'equalpro' and value != correct_equalpro_q5: error_equalpro_q5 = "correct answer: (20 - 0) + 0.4 x (0+30) = 32 points" return error_equalpro_q5 elif self.treatment == 'equalmain' and value != correct_equalmain_q5: error_equalmain_q5 = "correct answer: (20) + 0.4 x (80-30-20) = 32 points" return error_equalmain_q5 elif self.treatment == 'unequalpro' and value != correct_unequalpro_q5: error_unequalpro_q5 = "correct answer: (30 - 0) + 0.4 x (0+30) = 42 points" return error_unequalpro_q5 elif self.treatment == 'unequalmain' and value != correct_unequalmain_q5: error_unequalmain_q5 = "correct answer: (30) + 0.4 x (80-20-30) = 42 points" return error_unequalmain_q5 question6 = models.FloatField( label="", min=0, ) def question6_error_message(self, value): correct_equalpro_q6 = 27.2 correct_equalmain_q6 = 27.2 correct_unequalpro_q6 = 39 correct_unequalmain_q6 = 39 if self.treatment == 'equalpro' and value != correct_equalpro_q6: error_equalpro_q6 = "correct answer: (20 - 8) + 0.4 x (8+30) = 27.2 points" return error_equalpro_q6 elif self.treatment == 'equalmain' and value != correct_equalmain_q6: error_equalmain_q6 = "correct answer: (12) + 0.4 x (80-30-12) = 27.2 points" return error_equalmain_q6 elif self.treatment == 'unequalpro' and value != correct_unequalpro_q6: error_unequalpro_q6 = "correct answer: (30 - 5) + 0.4 x (5+30) = 39 points" return error_unequalpro_q6 elif self.treatment == 'unequalmain' and value != correct_unequalmain_q6: error_unequalmain_q6 = "correct answer: (25) + 0.4 x (80-20-25) = 39 points" return error_unequalmain_q6 question7 = models.FloatField( label="", min=0, ) def question7_error_message(self, value): correct_equalpro_q7 = 23 correct_equalmain_q7 = 23 correct_unequalpro_q7 = 37.2 correct_unequalmain_q7 = 37.2 if self.treatment == 'equalpro' and value != correct_equalpro_q7: error_equalpro_q7 = "correct answer: (20 - 15) + 0.4 x (15+30) = 23 points" return error_equalpro_q7 elif self.treatment == 'equalmain' and value != correct_equalmain_q7: error_equalmain_q7 = "correct answer: (5) + 0.4 x (80-30-5) = 23 points" return error_equalmain_q7 elif self.treatment == 'unequalpro' and value != correct_unequalpro_q7: error_unequalpro_q7 = "correct answer: (30 - 8) + 0.4 x (8+30) = 37.2 points" return error_unequalpro_q7 elif self.treatment == 'unequalmain' and value != correct_unequalmain_q7: error_unequalmain_q7 = "correct answer: (22) + 0.4 x (80-20-22) = 37.2 points" return error_unequalmain_q7 ################################################ gender = models.StringField( choices=[ ['1', 'Male'], ['2', 'Female'], ['3', 'Other'], ], label="1. What is your gender?", widget=widgets.RadioSelect ) age = models.IntegerField( label="2. What is your age?", min = 0, max = 120 ) language = models.StringField( choices=[ ['1', 'Yes'], ['2', 'No'], ], label="3. Is English your first language?", widget=widgets.RadioSelect ) max_income = models.StringField( choices=[ ['1', 'Very important'], ['2', 'Important'], ['3', 'Indifferent'], ['4', 'Not important'], ['5', 'Not important at all'], ], label="4. How important was for you to maximise your own income during the experiment?", widget=widgets.RadioSelect ) trust = models.StringField( choices=[ ['1', 'Most people can be trusted'], ['2', 'You need to be very careful in dealing with people'], ], label="5. Generally speaking, would you say that most people can be trusted or that you need to be very " "careful in dealing with people?", widget=widgets.RadioSelect ) risk = models.StringField( choices=[ ['1', ''], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', ''], ['8', ''], ['9', ''], ['10', ''], ], label="", widget=widgets.RadioSelectHorizontal ) instructions = models.StringField( choices=[ ['1', 'Very difficult'], ['2', 'Difficult'], ['3', 'Neutral'], ['4', 'Easy'], ['5', 'Very easy'], ], label="7. How did you find the instructions?", widget=widgets.RadioSelect ) econ_exp = models.IntegerField( label="8. How many economics experiments have you participated in before this one? ", ) ################################################ Q1 = models.IntegerField( label="1.A bat and a ball cost $1.10 in total. The bat costs a dollar more than the ball. How much does the ball cost (in cents)? ", min=0 ) Q2 = models.IntegerField( label="2.If it takes 5 machines 5 minutes to make 5 widgets, how long would it take 100 machines to make 100 widgets (in minutes)?", min=0 ) Q3 = models.IntegerField( label="3.In a lake, there is a patch of lily pads. Every day, the patch doubles in size. If it takes 48 days for the patch to cover the entire lake, how long would it take for the patch to cover half of the lake (in days)?", min=0 ) Q4 = models.StringField( choices=[ ['1', '5 out of 50 throws'], ['2', '25 out of 50 throws'], ['3', '30 out of 50 throws'], ['4', 'None of the above '], ], label="1. Imagine we are throwing a five-sided die 50 times. On average, out of these 50 throws how many times would this five-sided die show an odd number (1, 3 or 5)? ", widget=widgets.RadioSelect ) Q5 = models.StringField( choices=[ ['1', '10%'], ['2', '25%'], ['3', '40%'], ['4', 'None of the above '], ], label="2. Out of 1,000 people in a small town 500 are members of a choir. Out of these 500 members in the choir 100 are men. Out of the 500 inhabitants that are not in the choir 300 are men. What is the probability that a randomly drawn man is a member of the choir? ", widget=widgets.RadioSelect ) Q6 = models.StringField( choices=[ ['1', '20 out of 70 throws'], ['2', '23 out of 70 throws'], ['3', '35 out of 70 throws'], ['4', 'None of the above '], ], label="3. Imagine we are throwing a loaded die (6 sides). The probability that the die shows a 6 is twice as high as the probability of each of the other numbers. On average, out of these 70 throws, how many times would the die show the number 6? ", widget=widgets.RadioSelect ) Q7 = models.StringField( choices=[ ['1', '4%'], ['2', '20%'], ['3', '50%'], ['4', 'None of the above '], ], label="4. In a forest 20% of mushrooms are red, 50% brown and 30% white. A red mushroom is poisonous with a probability of 20%. A mushroom that is not red is poisonous with a probability of 5%. What is the probability that a poisonous mushroom in the forest is red? ", widget=widgets.RadioSelect ) Q3_1 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal ) Q3_2 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal ) Q3_3 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal ) Q3_4 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal ) Q3_5 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal ) Q3_6 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal ) Q3_7 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal ) Q3_8 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal ) Q3_9 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal ) Q3_10 = models.StringField( choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'] ], label="", widget=widgets.RadioSelectHorizontal )