from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random class Constants(BaseConstants): name_in_url = 'exp' players_per_group = None num_rounds = 1 PointsImport_dict = {"test@gmail.com": 500, "test2@gmail.com": 750} class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Instructions p_label = models.StringField(label="Enter the number of your computer") birth_date = models.StringField(label="What is your birth date? Please enter it in this format 30.08.1980 ") email = models.StringField( label="What is the email address you have used in the online survey?") def email_error_message(self, value): if value not in Constants.PointsImport_dict: return '''This email address has not been found in the database, please try again. If you can't remember it, please reaise your hand''' # Attitudes questions def make_field(label): return models.IntegerField( choices=[[1, "strongly disagree"], [2, "disagree"], [3, "somewhat disagree"], [4, "neutral"], [5, "somewhat agree"], [6, "agree"], [7, "strongly agree"]], label=label, widget=widgets.RadioSelectHorizontal, ) a1 = make_field('Only humans can experience complex emotions.') a2 = make_field('Cows can feel fear and pain.') a3 = make_field('Chickens can experience happiness.') a4 = make_field('Pigs play for fun, are inquisitive, and can solve relatively complex problems.') a5 = make_field('Fish can collaborate on week long projects in group.') a6 = make_field('Cows can recognise themselves in a mirror.') a7 = make_field('Animals are inferior to humans.') a8 = make_field('A chicken is an individual.') f1 = make_field('I believe that it is important to support milk farmers.') f2 = make_field('Most farmers love the animals they care for.') f3 = make_field('Animals are mostly treated well in farms in Switzerland.') f4 = make_field('It is immoral to harm animals for the production of food.') f5 = make_field('I consider myself sympathetic to animal rights.') f6 = make_field('The way meat is produced in Switzerland is morally wrong.') f7 = make_field('Animal agriculture is necessary for good land management.') f8 = make_field('The needs of farmers should be prioritised over animals.') e1 = make_field('I consider myself sympathetic to environmental protection.') e2 = make_field('Living a healthy lifestyle is important to me.') e3 = make_field('Deforestation is a major concern for humanity.') e4 = make_field('Preserving jobs is more important than reducing CO2 emissions.') h1 = make_field('I prioritise tasty food over healthy food.') h2 = make_field('Eating healthy food gives me satisfaction.') h3 = make_field('I always choose food options considering if they are healthy.') h4 = make_field('Reducing human induced climate change should be a priority for governments.') # KNOWLEDGE QUESTIONS k1 = models.IntegerField(widget=widgets.RadioSelect, label="One vitamin that is only found in animal derived products, and is therefore a common deficiency in vegan diets is:") k2 = models.IntegerField(widget=widgets.RadioSelect, label="In Swiss farms, what is the minimum space per pig that is legally required?") k3 = models.IntegerField(widget=widgets.RadioSelect, label="In Swiss farms, the percentage of pigs that live their whole life without having the possibility to go outside is:") k4 = models.IntegerField(widget=widgets.RadioSelect, label ="What is the maximun number of chicken a 'BIO' labeled egg laying farm can have in Switzerland?") k5 = models.IntegerField(widget=widgets.RadioSelect, label="Which of the following food choices have more protein?") k6 = models.IntegerField(widget=widgets.RadioSelect, label="The production of which of the following items requires the largest land use?") k7 = models.IntegerField(widget=widgets.RadioSelect, label='''According to the Swiss Confederation’s nutrition strategy 2017-2021: on average, how much meat do the Swiss eat compared to what would be optimal for their health?''') k8 = models.IntegerField(widget=widgets.RadioSelect, label="Of the following athletes how many claim to have a vegan or mostly vegan diet? Serena Williams (7 time Wimbledon Tennis Champion) Michael Phelps (Most Decorated Olympian of All Time, American Swimmer) Tom Brady (Quarterback for the New England Patriots, has won more Super Bowls than any other player in NFL history)") # KNOWLEDGE SHUFFLE def k1_choices(self): choices = [[2, "Vitamin E"], [1, "Vitamin B12"], [3, "Folic Acid"],[4, "Magnesium"]] random.shuffle(choices) choices.append([5, "I don't know"]) return choices def k2_choices(self): choices = [[2, "4 square meter"], [1, "0.9 square meter"], [3, "1.8 square meter"], [4, "3.2 square meter"]] random.shuffle(choices) choices.append([5, "I don't know"]) return choices def k3_choices(self): choices = [[1, "58%"], [2, "0%"], [3, "36%"], [4, "88%"]] random.shuffle(choices) choices.append([5, "I don't know"]) return choices def k4_choices(self): choices = [[2, "100"], [1, "4'000"], [3, "500"], [4, "8'000"]] random.shuffle(choices) choices.append([5, "I don't know"]) return choices def k5_choices(self): choices = [[2, "100g of almonds"], [1, "100g of chicken breast"], [3, "100g of chickpeas"], [4, "100g of beefsteak"]] random.shuffle(choices) choices.append([5, "I don't know"]) return choices def k6_choices(self): choices = [[1, "100g of protein from beef"], [2, "100g of protein from chicken"], [3, "100g of protein from lentils"], [4, "100g of protein from tofu"]] random.shuffle(choices) choices.append([5, "I don't know"]) return choices def k7_choices(self): choices = [[2, "Meat consumption is 7x too high"], [1, "Meat consumption is 3x too high"], [3, "Meat consumption is approximately at the right level"], [4, "Meat consumption is 2x too low"]] random.shuffle(choices) choices.append([5, "I don't know"]) return choices def k8_choices(self): choices = [[2, "0"], [3, "1"], [1, "2"],[4, "3"]] random.shuffle(choices) choices.append([5, "I don't know"]) return choices # CONTROL QUESTIONS WTP_i1 = models.IntegerField(widget=widgets.RadioSelect, label="Suppose you have selected a minimum acceptable payoff of -50 for item 1. The computer randomly selected a payoff of +40 for item 1. What happens?" , choices=[[1, "The offer is accepted: you get item 1 & you get 40 points"], [2, "The offer is accepted: you get item 1 & you lose 50 points"], [3, "The offer is refused: you do not get item 1 & you get no payoff"], [4, "The offer is refused: you do not get item 1 & you lose 50 points"] ] ) WTP_i2 = models.IntegerField(widget=widgets.RadioSelect, label="Suppose you have selected a minimum acceptable payoff of +50 for item 2. The computer randomly selected a payoff of +19 for item 2. What happens?", choices=[[3, "The offer is accepted: you get item 2 & you get 19 points"], [2, "The offer is accepted: you get item 2 & you lose 19 points"], [1, "The offer is refused: you do not get item 2 & you get no payoff"], [4, "The offer is refused: you do not get item 2 & you lose 19 points"] ] ) WTP_i3 = models.IntegerField(widget=widgets.RadioSelect, label="Suppose you have selected a minimum acceptable payoff of 0 for item 3. The computer randomly selected a payoff of -10 for item 3. What happens?" , choices=[[3, "The offer is accepted: you get item 3 & you get 10 points"], [2, "The offer is accepted: you get item 3 & you lose 10 points"], [1, "The offer is refused: you do not get item 3 & you get no payoff"], [4, "The offer is refused: you do not get item 3 & you lose 10 points"] ] ) WTP_i4 = models.IntegerField(widget=widgets.RadioSelectHorizontal, label="Suppose you want item 4 and are ready to accept any offer for it. What should you answer to 'What is your minimum acceptable payoff for item 4?'", choices=[[1, "-75"], [2, "-50"], [3, "-25"], [4, "0"], [5, "+25"], [6, "+50"], [5, "+75"] ] ) WTP_i5 = models.IntegerField(widget=widgets.RadioSelectHorizontal, label="Suppose you do not want item 5 and want to refuse any offer for it. What should you answer to 'What is your minimum acceptable payoff for item 5?'", choices=[[7, "-75"], [2, "-50"], [3, "-25"], [4, "0"], [5, "+25"], [6, "+50"], [1, "+75"]] ) WTP_i6 = models.IntegerField( label=''' How many CHF will 800 points be converted for at the end of the experiment? ''') #CONTROL QUESTIONS ERROR MESSAGES def WTP_i1_error_message(self, value): if value is not 1: return 'Your answer is wrong. Please reconsider your answer. If you are unsure about the answer please raise your hand.' def WTP_i2_error_message(self, value): if value is not 1: return 'Your answer is wrong. Please reconsider your answer. If you are unsure about the answer please raise your hand.' def WTP_i3_error_message(self, value): if value is not 1: return 'Your answer is wrong. Please reconsider your answer. If you are unsure about the answer please raise your hand.' def WTP_i4_error_message(self, value): if value is not 1: return 'Your answer is wrong. Please reconsider your answer. If you are unsure about the answer please raise your hand.' def WTP_i5_error_message(self, value): if value is not 1: return 'Your answer is wrong. Please reconsider your answer. If you are unsure about the answer please raise your hand.' def WTP_i6_error_message(self, value): if value is not 8: return 'Your answer is wrong. Please reconsider your answer. If you are unsure about the answer please raise your hand.' #WTP QUESTIONS def WTP(label): return models.IntegerField( choices=[[-75, "-75"], [-50, "-50"], [-25, "-25"], [0, "0"], [25, "+25"], [50, "+50"], [75, "+75"]], label=label, widget=widgets.RadioSelectHorizontal, ) WTP_ba = WTP("What is your minimum acceptable payoff for information about: 'The way cows are treated for beef production' ?") WTP_be = WTP("What is your minimum acceptable payoff for information about: 'The impact of beef production on the environment' ?") WTP_bh = WTP("What is your minimum acceptable payoff for information about: 'The effect of consuming beef on health' ? ") WTP_ca = WTP("What is your minimum acceptable payoff for information about: 'The way crocodiles are treated for producing meat' ?") WTP_ce = WTP("What is your minimum acceptable payoff for information about: 'The impact of crocodile farming on the environment' ? ") WTP_ch = WTP("What is your minimum acceptable payoff for information about: 'The effects of consuming crododile on health' ?") # variables for WTP draw and results see WTP_Beef and WTP_Croc in pages.py WTP_drawn_b = models.IntegerField() offer_b = models.FloatField() infodraw_b = models.IntegerField() info_draw_b_string = models.StringField() aor_b = models.StringField() WTP_drawn_c = models.IntegerField() offer_c = models.FloatField() infodraw_c = models.IntegerField() info_draw_c_string = models.StringField() aor_c = models.StringField() money = models.IntegerField() online_points = models.IntegerField()