from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'my_seq_v2' players_per_group = 3 num_rounds = 1 n = random.randint(1, 100) class Subsession(BaseSubsession): pass class Group(BaseGroup): z1_choice = models.StringField( choices=("Extra money never hurts", "Financial need", "To revenge company", "To revenge a co-worker", "Low salary", "To trap someone else"), widget=widgets.RadioSelect ) q1_choice = models.StringField( choices=("I am faithful to the company", "My Conscience matters and I cannot just be an observer to a fraud", "I have to protect the interests to the organisation", "I will blow the whistle if I do not like the perpetrator"), widget=widgets.RadioSelect ) q2_choice = models.StringField( choices=("I might get hurt because of retaliation by the perpetrator or others", "If I am not affected, I will not blow the whistle.", "I do not get any benefits by blowing the whistle", "I will not blow the whistle if the perpetrator is a friend or a person close to me", "I do not find the fraud so harmful", "I might be harming the company", "I might be harming the company’s reputation", "The cost of my reputation loss will be much higher than the benefit of whistleblowing"), widget=widgets.RadioSelect ) q3_choice = models.StringField( choices=("I will do so when I am not sure what to do", "I might need reassurance of my decision", "I am afraid of repercussions and my friend’s support might be useful to me"), widget=widgets.RadioSelect ) q4_choice = models.StringField( choices=("I do not trust the friend enough", "I do not trust anyone in the organisation"), widget=widgets.RadioSelect ) q5_choice = models.StringField( choices=("Regular financial incentives for whistleblowing", "A lifelong pension or salary protection", "Other forms of recognition"), widget=widgets.RadioSelect ) q6_choice = models.StringField( choices=( "As whistleblowing is done to keep up with my ideals Incentives might crowd out the motivation for whistleblowing", "Incentives can make whistleblowing look transactional"), widget=widgets.RadioSelect ) q7_choice = models.StringField( choices=("Yes, I will stand for my ideals", "Yes, it is important", "Yes, I am faithful to my organisation", "Yes, I have to keep up to my conscience", "Yes, I need to keep the interest of the organisation", "Yes, because I do not like the perpetrator", "No, because I may lose the job.", "No, I might lose my life.", "No, My family might be hurt", "No, there might be retaliation", "No, I do not want the limelight"), widget = widgets.RadioSelect ) a_choice = models.StringField( choices=("commit", "not commit"), widget=widgets.RadioSelect ) a1_choice = models.StringField( choices=("report", "not report"), widget=widgets.RadioSelect ) a2_choice = models.StringField( choices=("retaliate", "not retaliate"), widget=widgets.RadioSelect ) a3_choice = models.StringField( choices=("ask","don't ask"), widget=widgets.RadioSelect ) a4_choice = models.StringField( choices=("report", "not to report"), widget=widgets.RadioSelect ) def set_payoffs(self): p1 = self.get_player_by_id(1) p2 = self.get_player_by_id(2) p3 = self.get_player_by_id(3) p3.payoff = c(0) if self.a_choice == "not commit": if self.a1_choice == "report": p1.payoff = c(60) p2.payoff = c(45) else: p1.payoff = c(80) p2.payoff = c(50) else: if self.a1_choice == "report": if Constants.n < 80: if self.a2_choice == "retaliate": p1.payoff = c(95) p2.payoff = c(30) elif self.a2_choice == "not retaliate": p1.payoff = c(100) p2.payoff = c(50) else: if self.a2_choice == "retaliate": p1.payoff = c(55) p2.payoff = c(30) elif self.a2_choice == "not retaliate": p1.payoff = c(60) p2.payoff = c(50) elif self.a1_choice == "not report": if Constants.n < 95: p1.payoff = c(100) p2.payoff = c(50) else: p1.payoff = c(60) p2.payoff = c(50) class Player(BasePlayer): name = models.StringField() age = models.IntegerField() gender = models.StringField( choices=("Male", "Female", "Do not want to mention") ) degree = models.StringField() work_Experience = models.StringField( choices=("yes", "No") ) number_of_months = models.IntegerField() Designation = models.StringField() ##different page with condition for these two fields