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 = 'questionnaire_3' players_per_group = None num_rounds = 1 def translate_colors(colors): c1, c2 = list(), list() c_dict = dict() c_dict['red'] = '红色' c_dict['blue'] = '蓝色' c_dict['orange'] = '橙色' c_dict['green'] = '绿色' c_dict['black'] = '黑色' c_dict['grey'] = '灰色' for i in colors[0]: c1.append(c_dict[i]) for i in colors[1]: c2.append(c_dict[i]) return [c1, c2] def fields(pp): fields_to, fields_from = list(), list() a, b = 1, 0 for i in pp: fields_from.append(a) a = a + i b = b + i fields_to.append(b) return [fields_from, fields_to] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): #####cognitive reflection task############ Crt_Bat = models.FloatField( label=''' Q1. 一个球拍和一个球总共卖1.10元,球拍比球多卖1.00元,请问球的价格是多少元?''', ) Crt_Widget = models.FloatField( label=''' Q2. 如果5个机器耗时5分钟制作了5个装饰品,请问100个机器制作100个装饰品要耗时多久?''', ) Crt_Lake = models.FloatField( label=''' Q3. 湖面上有一片睡莲,它们每天以两倍的数量增加着。如果睡莲铺满整个湖面需要48天,那么它覆盖湖面的一半区域需要几天?''', ) Know = models.StringField( choices=['是', '否'], label=''' Q4. 您是否曾经看到过或者回答过上述问题?''', widget=widgets.RadioSelect() ) # ##### Regret questions ####################### # # Regret_1 = models.IntegerField( # label=''' # Q5. 每当我做选择时,我都会好奇如果我的选择不同会发生什么(1代表''完全不同意'',5代表''完全同意'')''', # choices=[1, 2, 3, 4, 5], # widget=widgets.RadioSelectHorizontal # ) # # Regret_2 = models.IntegerField( # label=''' # Q6. 每当我做选择时,我都会试图了解其他选择的结果(1代表''完全不同意'',5代表''完全同意'')''', # choices=[1, 2, 3, 4, 5], # widget=widgets.RadioSelectHorizontal # ) # # Regret_3 = models.IntegerField( # label=''' # Q7. 即使我做的决定有很好的结果,如果我发现其他选择会有更好的结果,我仍然会感觉有些挫败(1代表''完全不同意'',5代表''完全同意'')''', # choices=[1, 2, 3, 4, 5], # widget=widgets.RadioSelectHorizontal # ) # # Regret_4 = models.IntegerField( # label=''' # Q8. 当我回想我现在的生活状况时,我经常会考量我已经错过的机会(1代表''完全不同意'',5代表''完全同意'')''', # choices=[1, 2, 3, 4, 5], # widget=widgets.RadioSelectHorizontal # ) # # Regret_5 = models.IntegerField( # label=''' # Q9. 我一旦决定了前面的路怎么走,就不会再回头看(1代表''完全不同意'',5代表''完全同意'')''', # choices=[1, 2, 3, 4, 5], # widget=widgets.RadioSelectHorizontal # ) # ##### Risk questions ############################# # # Q_risk = models.IntegerField( # label=''' # Q10. 请评价自己:您是愿意冒险的人还是试图规避风险的人(0代表''完全不愿意冒险'',10代表''非常愿意冒险'')''', # choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], # widget=widgets.RadioSelectHorizontal # ) # # # ##### Regret questions in the loss and gain domain ####################### # # Regret_G = models.IntegerField( # label=''' # Q11. 您选择不投资该项目。与此同时,该投资项目的价值翻了一番多。这意味着如果您之前投资了该项目,您本可以获得巨大的收益。在这种情况下,今天的您会(1代表着“非常后悔没有参与投资”,5代表着“完全不后悔”) # ''', # choices=[1, 2, 3, 4, 5], # widget=widgets.RadioSelectHorizontal # ) # # Regret_L = models.IntegerField( # label=''' # Q12. 现在请思考另一种情况。您在该项目中投资了大量的资金,与此同时,市场不景气,该投资项目的价值缩水一半。在这种情况下,今天的您会(1代表着“非常后悔参与投资”,5代表着“完全不后悔”) # ''', # choices=[1, 2, 3, 4, 5], # widget=widgets.RadioSelectHorizontal # ) # ##### Numeracy questions############### # # N_1 = models.FloatField( # label='''Q13. 假设您投掷一枚公平的硬币1000次,你认为有多少次这枚硬币会反面朝上?''' # , # # ) # # N_2 = models.FloatField( # label= # '''Q14. 中国的小型彩票有1%的概率会中奖10元。请您猜测如果有1000个人每人买一张彩票,会有多少人能获得10元的奖金?''' # , # ) # #old question # # N_3 = models.FloatField( # # label= # # '''Q15. 在另一种彩票中,有千分之一的概率能中奖一辆轿车。请问平均多少张彩票能中奖一辆轿车?''', # # # # ) # # N_3 = models.FloatField( # label='''Q15. 森林里有20%的蘑菇是红色,50%是棕色,30%是白色。红蘑菇有毒的可能性为20%,而非红色蘑菇有毒的可能性为5%。请问森林中有毒蘑菇是红色的概率是多少?''', # ) # # N_4 = models.FloatField( # label='''Q16. 小镇上的1000人中有500人是合唱团成员。500名合唱团成员中有100名是男性,500名不是合唱团的居民中有300名是男性。请问随机抽取一名男性是合唱团成员的概率有多大?请用小数的形式表示''', # # ) # # N_5 = models.FloatField( # label='''Q17. 假设我们投掷一枚五边形的骰子50次,平均而言,在这50次的投掷中,有多少次五边形骰子会显示为奇数(1、3、5)?''', # # ) # # # N_5b =models.FloatField( # # label='''Q16. Imagine we are throwing a loaded die (6 sides). The probability that the die shows a 6 is twice as # # high as the probability of each of the other numbers. On average, out of these 70 throws how many times would # # the die show the number 6?''', # # ) ###### Demographic questions ########### Age = models.IntegerField( label='Q1. 请问您的年龄是?', min=1, max=100) gender = models.StringField( choices=['男性', '女性', '其他'], label='Q2. 请问您的性别是?', widget=widgets.RadioSelect) Gender_other = models.StringField(blank=True, label='如果选择“其他”,请具体说明' ) # # Nation = models.StringField( # label='Q20. 请问您的国籍是?' # ) # Major = models.StringField( # choices=['会计', '经济', '金融', # '工商管理(除会计、经济、金融的其他商科专业)' # , '教育', '工程学', '医疗卫生', '社会科学或历史学', # '数学,计算机或物理学', '生物学', '人文科学', # '公共事务管理或社会服务类', '心理学', # '其他(如果您不是学生,请选择“其他”并说明您的职业)' # ], # label='Q21. 请问您的专业是?', # widget=widgets.RadioSelect) # # Major_other = models.StringField(blank=True, # # label='如果选择“其他”,请具体说明:' # ) Education = models.StringField( choices=['低于高中','高中', '本科', '硕士', '博士', '以上均不适用' ], label='Q3. 请问您的最高学历是?', widget=widgets.RadioSelect) HH_income = models.StringField( choices=['15万以下', '15万至25万', '25万-35万', '35万-45万', '45万以上', '我不想回答' ], label='Q4. 请问您的总家庭年收入是?', widget=widgets.RadioSelect) # Work = models.IntegerField( # choices=[[1, '是'], [0, '否']], # label='Q24. 请问您有带薪工作吗?', # widget=widgets.RadioSelect) Occupation = models.StringField( choices=['学生', '退休', '失业或者无业', '非全日制就业', '全职工作', '其他' ], label='Q5. 请问您目前的工作状态是?', widget=widgets.RadioSelect) Marriage = models.StringField(choices=["已婚", "离异", "丧偶", "未婚", "我不想回答" ], label='Q6. 请问您目前的婚姻状态是?', widget=widgets.RadioSelect, )