from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'introduction' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def make_field(label): return models.IntegerField( choices=[5,4,3,2,1], label=label, widget=widgets.RadioSelect, ) class Player(BasePlayer): #demographic data age = models.IntegerField( label="What is your age?:") def age_error_message(self,x): print('x is',x) if x<10: return 'Please enter valid age.' if x>90: return 'Please enter valid age.' gender = models.StringField( choices=["Male", "Female","Other"], widget=widgets.RadioSelectHorizontal, label="Gender") educational_background = models.StringField( choices=["Abitur", "Bachelor's degree", "Master's degree", "Doctorate", "Other"], widget=widgets.RadioSelect, label="What is your highest academic level?") employment = models.StringField( choices=["Employed full-time (40+ hours a week)", "Employed part-time (less than 40 hours a week)","Student","Other"], widget=widgets.RadioSelect, label="What is your current employment status?") #IBT - 2,4-6 should be reverse coded ib1 = make_field("I usually only buy things that I intended to buy.") ib2 = make_field("If I buy something, I usually do that spontaneously.") ib3 = make_field("Most of my purchases are planned in advance.") ib4 = make_field("I only buy things that I really need.") ib5 = make_field("It is not my style to just buy things.") ib6 = make_field("I am used to buying things 'on the spot'.") ib7 = make_field("I often buy things without thinking.") ib8 = make_field("I sometimes cannot suppress the feeling of wanting to buy something.") ib9 = make_field("I find it difficult to pass up a bargain.") ib10 = make_field("I am a bit reckless in buying things.") #EA q1 = make_field("I try to separate trash for recycling on a regular basis.") q2 = make_field("I prefer to use environmentally-friendly products.") q3 = make_field("I want to use products that I currently have as long as possible.") q4 = make_field("Global warming can be avoided by my pro-environmental behavior.") q5 = make_field("Everyone's small daily efforts will lead to CO2 emission reduction.") q6 = make_field("Using daily necessities carefully over a long period will be effective in avoiding global warming.") q7 = make_field("A lot of CO2 is emitted as a result of my activities.") q8 = make_field("I am responsible for global warming.") q9 = make_field("My life is one of the causes of infectious diseases, abnormal weather, and a decrease in species.") q10 = make_field("It is not difficult to reduce CO2 emission in my daily life.") q11 = make_field("It is not hard to change my life in order to avoid global warming.") q12 = make_field("I can give up a few things I want in order to solve the global warming problem.") q13 = make_field("There are many opportunities and ways in my life to avoid global warming.") q14 = make_field("I can easily come up with what I can do for reducing CO2 emission.") q15 = make_field("Everyone can select environmentally-friendly products or take action for reduction CO2 emission.") q16 = make_field("Global warming is a critical issue.") q17 = make_field("We have to take measures against global warming as soon as possible.") q18 = make_field("It is not allowed to put off measures against global warming.") q19 = make_field("CO2 emitted from factories and power plants are related to daily necessities around me.") q20 = make_field("My daily activities have impacts on CO2 emission due to resource use, product manufacturing, and product transportation.") q21 = make_field("I myself have to make efforts to reduce CO2 emission associated with product manufacturing.") q22 = make_field("I would like to know the amount of CO2 emission associated with my product and service use.") q23 = make_field("Information on environmentally-conscious products should be disclosed more actively.") q24 = make_field("More information is needed to take appropriate actions for reducing CO2 emission.") q25 = make_field("I consider myself to be an environmentally aware person.") q26 = make_field("I am reading through the questions attentively, choose strongly disagree for this question.") #comprehension questions question1 = models.StringField( choices=['True','False'], widget=widgets.RadioSelectHorizontal, label="1. You must choose at least two items per page.") question2 = models.StringField( choices=['Products on the top are optional products', 'Products not on the shopping list are optional products'], widget=widgets.RadioSelectHorizontal, label="2. Which statement is true about the optional products?") question3 = models.StringField( choices=['The most eco-friendly item','Item with the best quality'], widget=widgets.RadioSelectHorizontal, label="3. Which item should you choose to maximise your payout?") question4= models.StringField( choices=['True','False'], widget=widgets.RadioSelectHorizontal, label="4. There is only one eco-friendly item for each mandatory and optional product ") question5 = models.StringField( choices=['True','False'], widget=widgets.RadioSelectHorizontal, label="5. I use the starting 5€ to buy items based on the price displayed.") question6 = models.StringField( choices=['True','False'], widget=widgets.RadioSelectHorizontal, label="6. My payout is maximized through buying as many products as possible.")