from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) from django.forms.widgets import CheckboxSelectMultiple author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'BaNu_questionnaire' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass #def creating_session(self): #import itertools #treat_type = itertools.cycle(['bA', 'nA', 'bB', 'nB']) #for p in self.get_players(): #p.participant.vars['first_out'] = False #p.treat_type = next(treat_type) #if p.treat_type == 'bA' or p.treat_type == 'bB': #p.treatment = 0 #p.participant.vars['treatment'] = 0 #else: #p.treatment = 1 #p.participant.vars['treatment'] = 1 #if p.treat_type == 'bA' or p.treat_type == 'nA': #p.participant.vars['type'] = 'A' #else: #p.participant.vars['type'] = 'B' class Group(BaseGroup): pass class Player(BasePlayer): #treat_type=models.CharField() mturk_id = models.CharField() paying_round = models.IntegerField() disagreement = models.BooleanField() nuclear = models.BooleanField() payment = models.FloatField() treatment = models.IntegerField() instructions = models.BooleanField(choices=[(True, "Yes"), (False, "No")], widget=widgets.RadioSelect, label="Were the instructions clear?") instructions_comment = models.CharField(label="Comments:", blank=True) hitches = models.CharField(label="In case you experienced any hitches during the survey, please describe them here:", blank=True) fair_play = models.IntegerField(choices=[(1, ''), (2, ''), (3, ''), (4, ''), (5, ''), (6, ''), (7, '')], label="On a scale from 1 to 7, is this a sort of situation in which people " "ought to “play fair” in your view or is it acceptable if people try to " "get the best outcome for themselves and make the best " "use of their bargaining power?", widget=widgets.RadioSelect) strategy = models.CharField(label="Please give a brief description of your bargaining strategy:") worried_A = models.IntegerField(choices=[(1, ''), (2, ''), (3, ''), (4, ''), (5, ''), (6, ''), (7, '')], label="Overall, how worried were you that person B might use the ‘Reduce tokens’ option?", widget=widgets.RadioSelect) main_belief_A = models.IntegerField(choices=[(1, ''), (2, ''), (3, ''), (4, ''), (5, ''), (6, '')], label="",widget=widgets.RadioSelect) main_belief_A_other = models.CharField(label="", blank=True) further_belief_A_1 = models.BooleanField(initial=False, label="", blank=True) further_belief_A_2 = models.BooleanField(initial=False, label="", blank=True) further_belief_A_3 = models.BooleanField(initial=False, label="", blank=True) further_belief_A_4 = models.BooleanField(initial=False, label="", blank=True) further_belief_A_5 = models.BooleanField(initial=False, label="", blank=True) further_belief_A_6 = models.BooleanField(initial=False, label="", blank=True) further_belief_A_other = models.CharField(label="", blank=True) effect_strategy_A_1 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_A_2 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_A_3 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_A_4 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_A_5 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_A_6 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_A_other = models.CharField(label="", blank=True) effect_strategy_belief_A_1 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_A_2 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_A_3 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_A_4 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_A_5 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_A_6 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_A_other = models.CharField(label="", blank=True) worried_belief_B = models.IntegerField(choices=[(1, ''), (2, ''), (3, ''), (4, ''), (5, ''), (6, ''), (7, '')], label="Overall, how worried do you think person A was that you might use the ‘Reduce tokens’ option?", widget=widgets.RadioSelectHorizontal) temptation_B = models.IntegerField(choices=[(1, ''), (2, ''), (3, ''), (4, ''), (5, ''), (6, ''), (7, '')], label="Overall, how tempted were you to use the ‘Reduce tokens’ option?", widget=widgets.RadioSelectHorizontal) main_motive_B = models.IntegerField(choices=[(1, 'Being curious and wanting to try it out.'), (2, 'Anger about the way person A behaved during the negotiation.'), (3, 'No anger but wanting to teach person A a lesson.'), (4, 'Clicking the wrong button by accident.'), (5, 'Ensuring that he/she would earn more than person A.'), (6, 'Other reasons:')], label="", widget=widgets.RadioSelect) main_motive_B_other = models.CharField(label="", blank=True) further_motive_B_1 = models.BooleanField(initial=False, label="", blank=True) further_motive_B_2 = models.BooleanField(initial=False, label="", blank=True) further_motive_B_3 = models.BooleanField(initial=False, label="", blank=True) further_motive_B_4 = models.BooleanField(initial=False, label="", blank=True) further_motive_B_5 = models.BooleanField(initial=False, label="", blank=True) further_motive_B_6 = models.BooleanField(initial=False, label="", blank=True) further_motive_B_other = models.CharField(label="", blank=True) main_belief_B = models.IntegerField(choices=[(1, 'Being curious and wanting to try it out.'), (2, 'Anger about the way person A behaved during the negotiation.'), (3, 'No anger but wanting to teach person A a lesson.'), (4, 'Clicking the wrong button by accident.'), (5, 'Ensuring that he/she would earn more than person A.'), (6, 'Other reasons:')], label="", widget=widgets.RadioSelect) main_belief_B_other = models.CharField(label="", blank=True) further_belief_B_1 = models.BooleanField(initial=False, label="", blank=True) further_belief_B_2 = models.BooleanField(initial=False, label="", blank=True) further_belief_B_3 = models.BooleanField(initial=False, label="", blank=True) further_belief_B_4 = models.BooleanField(initial=False, label="", blank=True) further_belief_B_5 = models.BooleanField(initial=False, label="", blank=True) further_belief_B_6 = models.BooleanField(initial=False, label="", blank=True) further_belief_B_other = models.CharField(label="", blank=True) effect_strategy_B_1 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_B_2 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_B_3 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_B_4 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_B_5 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_B_6 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_B_other = models.CharField(label="", blank=True) effect_strategy_belief_B_1 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_B_2 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_B_3 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_B_4 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_B_5 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_B_6 = models.BooleanField(initial=False, label="", blank=True) effect_strategy_belief_B_other = models.CharField(label="", blank=True) returning = models.BooleanField(label="") def role(self): if self.participant.vars['type'] == 'A': return 'A' else: return 'B'