from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, Page, WaitPage ) cu = c doc = '' class Constants(BaseConstants): name_in_url = 'Survey1_old' players_per_group = None num_rounds = 1 instructions_template = 'Survey1_old/instructions.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def set_payoff(player): participant = player.participant import random offer1 = player.participant.vars['payoff1'] offer2 = player.participant.vars['payoff2'] offer3 = player.participant.vars['payoff3'] offer4 = player.participant.vars['payoff4'] offer5 = player.participant.vars['payoff5'] offer6 = player.participant.vars['payoff6'] offer7 = player.participant.vars['payoff7'] offer8 = player.participant.vars['payoff8'] offer9 = player.participant.vars['payoff9'] offer10 = player.participant.vars['payoff10'] offer11 = player.participant.vars['payoff11'] offer12 = player.participant.vars['payoff12'] offer = [offer1,offer2,offer3,offer4,offer5,offer6,offer7,offer8,offer9,offer10,offer11,offer12] offer13 = player.participant.vars['payoff13'] offer14 = player.participant.vars['payoff14'] offer15 = player.participant.vars['payoff15'] offer16 = player.participant.vars['payoff16'] offer17 = player.participant.vars['payoff17'] offer18 = player.participant.vars['payoff18'] offer19 = player.participant.vars['payoff19'] pay = [offer13,offer14,offer15,offer16,offer17,offer18,offer19] player.payoff = random.choice(offer)+random.choice(pay) class Player(BasePlayer): age = models.IntegerField(label='1.您的年龄', max=50, min=20) lastname = models.StringField(label='2.您的姓氏') gender = models.StringField(choices=[['1', '男'], ['2', '女']], label='3.您的性别', widget=widgets.RadioSelect) degree = models.StringField(choices=[['1', '硕士研究生'], ['2', 'MBA'], ['3', '博士研究生'], ['4', '其他']], label='4.您的学历', widget=widgets.RadioSelectHorizontal) major = models.StringField(label='5.您目前所修专业') grade = models.StringField(label='6.您的年级') course = models.StringField(label='7.您学过多少门会计相关的课程') university = models.StringField(label='8.您所在大学') hometown = models.StringField(choices=[['1', '大城市'], ['2', '中等城市'], ['3', '小城镇'], ['4', '农村']], label='9.您来自', widget=widgets.RadioSelectHorizontal) income = models.StringField(choices=[['1', '5千元以下'], ['2', '5千-1万'], ['3', '1万-3万'], ['4', '3万-6万'], ['5', '6万以上']], label='10.您家庭年人均收入', widget=widgets.RadioSelectHorizontal) fatherjob = models.StringField(choices=[['1', '党政机关'], ['2', '科教文卫'], ['3', '三资企业'], ['4', '国企'], ['5', '私企'], ['6', '下岗待业'], ['7', '农民'], ['8', '其他']], label='11.您父亲职业', widget=widgets.RadioSelectHorizontal) motherjob = models.StringField(choices=[['1', '党政机关'], ['2', '科教文卫'], ['3', '三资企业'], ['4', '国企'], ['5', '私企'], ['6', '下岗待业'], ['7', '农民'], ['8', '其他']], label='12.您母亲职业', widget=widgets.RadioSelectHorizontal) fatherdegree = models.StringField(choices=[['1', '小学'], ['2', '初中'], ['3', '高中、中专'], ['4', '大专'], ['5', '大学本科'], ['6', '研究生及以上学历']], label='13.您父亲学历', widget=widgets.RadioSelectHorizontal) motherdegree = models.StringField(choices=[['1', '小学'], ['2', '初中'], ['3', '高中、中专'], ['4', '大专'], ['5', '大学本科'], ['6', '研究生及以上学历']], label='14.您母亲学历', widget=widgets.RadioSelectHorizontal) pay = models.StringField(label='15.您的收款账号(请填写支付宝账号)') b1 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='1.外向的,精力充沛的', widget=widgets.RadioSelect) b2 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='2.爱批评人的,爱争吵的', widget=widgets.RadioSelect) b3 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='3.可信赖的,自律的', widget=widgets.RadioSelect) b4 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='4.忧虑的,易心烦的', widget=widgets.RadioSelect) b5 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='5.易接受新事物的,常有新想法的', widget=widgets.RadioSelect) b6 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='6.内向的,安静的', widget=widgets.RadioSelect) b7 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='7.招人喜爱的,友善的', widget=widgets.RadioSelect) b8 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='8.条理性差的,粗心的', widget=widgets.RadioSelect) b9 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='9.冷静的,情绪稳定的', widget=widgets.RadioSelect) b10 = models.StringField(choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='10.遵循常规的,不爱创新的', widget=widgets.RadioSelect) s1 = models.StringField(choices=[['1', 'A.自己获得480,他人获得80。'], ['2', 'B.自己获得540,他人获得280。'], ['3', 'C.自己获得480,他人获得480。']], label='1.情境1', widget=widgets.RadioSelect) s2 = models.StringField(choices=[['1', 'A.自己获得560,他人获得300。'], ['2', 'B.自己获得500,他人获得500。'], ['3', 'C.自己获得500,他人获得100。']], label='2.情境2', widget=widgets.RadioSelect) s3 = models.StringField(choices=[['1', 'A.自己获得520,他人获得520。'], ['2', 'B.自己获得520,他人获得120。'], ['3', 'C.自己获得580,他人获得320。']], label='3.情境3', widget=widgets.RadioSelect) s4 = models.StringField(choices=[['1', 'A.自己获得500,他人获得100。'], ['2', 'B.自己获得560,他人获得300。'], ['3', 'C.自己获得490,他人获得490']], label='4.情境4', widget=widgets.RadioSelect) s5 = models.StringField(choices=[['1', 'A.自己获得560,他人获得300。'], ['2', 'B.自己获得500,他人获得500。'], ['3', 'C.自己获得490,他人获得90。']], label='5.情境5', widget=widgets.RadioSelect) s6 = models.StringField(choices=[['1', 'A.自己获得500,他人获得500。'], ['2', 'B.自己获得500,他人获得100。'], ['3', 'C.自己获得570,他人获得300。']], label='6.情境6', widget=widgets.RadioSelect) s7 = models.StringField(choices=[['1', 'A.自己获得510,他人获得510。'], ['2', 'B.自己获得560,他人获得300。'], ['3', 'C.自己获得510,他人获得110。']], label='7.情境7', widget=widgets.RadioSelect) s8 = models.StringField(choices=[['1', 'A.自己获得550,他人获得300。'], ['2', 'B.自己获得500,他人获得100。'], ['3', 'C.自己获得500,他人获得500。']], label='8.情境8', widget=widgets.RadioSelect) s9 = models.StringField(choices=[['1', 'A.自己获得480,他人获得100。'], ['2', 'B.自己获得490,他人获得490。'], ['3', 'C.自己获得540,他人获得300。']], label='9.情境9', widget=widgets.RadioSelect) e0 = models.StringField(choices=[['1', '应该当选'], ['2', '无法决定'], ['3', '不应该当选']], label='', widget=widgets.RadioSelectHorizontal) e1 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5']], label='1.在处理班级事务上,候选人能做到面面俱到吗?', widget=widgets.RadioSelectHorizontal) e2 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5']], label='2.这位候选人具有良好的道德品质吗?', widget=widgets.RadioSelectHorizontal) e3 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5']], label='3.这位候选人身高最高?', widget=widgets.RadioSelectHorizontal) e4 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5']], label='4.这位候选人会是一个好的领导者?', widget=widgets.RadioSelectHorizontal) e5 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5']], label='5.这位候选人能将班级建设的更好?', widget=widgets.RadioSelectHorizontal) e6 = models.IntegerField(label='', max=5, min=1) e7 = models.IntegerField(label='', max=5, min=1) e8 = models.IntegerField(label='', max=5, min=1) e9 = models.IntegerField(label='', max=5, min=1) set_payoff = set_payoff