from otree.api import * c = cu doc = '' class Constants(BaseConstants): name_in_url = 'survey' players_per_group = None num_rounds = 1 appearance_fee = 5 trail9 = 10 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): gender = models.IntegerField(choices=[[0, '男'], [1, '女']], label='1.您的性别?', widget=widgets.RadioSelectHorizontal) only_child = models.IntegerField(choices=[[0, '否'], [1, '是']], label='2.您是独生子女吗?', widget=widgets.RadioSelectHorizontal) age = models.IntegerField(label='3.您的年龄?', max=80, min=10) college = models.StringField(label='4.您所属的学院?') grade = models.StringField(label='5.您所在的年级?') major = models.StringField(label='6.您所学的专业?') origin = models.StringField(label='7.您的生源地所在地(省份/城市)?') consumption = models.IntegerField(choices=[[1, '1000元以下'], [2, '1000-1500元'], [3, '1500-2000元'], [4, '2000-3000元'], [5, '3000元以上']], label='8.您在校期间的每月平均消费是?', widget=widgets.RadioSelectHorizontal) understand = models.IntegerField(choices=[[0, '否'], [1, '是']], label='9.您是否理解本次参与的实验任务?', widget=widgets.RadioSelectHorizontal) accurate_decisions = models.IntegerField(choices=[[1, '完全不同意'], [2, '比较不同意'], [3, '介于同意与不同意之间'], [4, '比较同意'], [5, '完全同意']], label='1).我的每次决策都是经过精确的计算', widget=widgets.RadioSelectHorizontal) fuzzy_decision = models.IntegerField(choices=[[1, '完全不同意'], [2, '比较不同意'], [3, '介于同意与不同意之间'], [4, '比较同意'], [5, '完全同意']], label='2).我的每次决策都只是粗略估计,凭感觉做出决策', widget=widgets.RadioSelectHorizontal) consideration = models.IntegerField(choices=[[1, '自己的收益'], [2, '对方的收益'], [3, '自己和对方的收益']], label='11.您在发送信息时,主要考虑?', widget=widgets.RadioSelectHorizontal) english_level = models.IntegerField(blank=True, choices=[[1, '完全不熟练'], [2, '比较不熟练'], [3, '介于熟练与不熟练之间'], [4, '比较熟练'], [5, '非常熟练']], label='12.请您为自己的总体英语水平打分', widget=widgets.RadioSelectHorizontal) second_foreign_language1 = models.IntegerField(choices=[[0, '否'], [1, '是']], label='13.您是否学习了第二外语?', widget=widgets.RadioSelectHorizontal) second_foreign_language2 = models.StringField(label='14.您所学的第二外语是?(若未学习第二外语,请填无)') start_english = models.IntegerField(choices=[[1, '小学及以下'], [2, '初中'], [3, '高中'], [4, '大学'], [5, '其他']], label='15.您是什么时候开始学习英语?', widget=widgets.RadioSelectHorizontal) english_reading = models.IntegerField(choices=[[1, '10本以上'], [2, '6-10本'], [3, '1-5本'], [4, '从来没阅读过英语原版书']], label='16.您阅读过几本英语原版书?', widget=widgets.RadioSelectHorizontal) TV_series = models.IntegerField(choices=[[1, '非常需要'], [2, '基本不需要'], [3, '完全不需要'], [4, '中英文字幕都不需要']], label='17.您看英剧/美剧需要看中文字幕吗?', widget=widgets.RadioSelectHorizontal) english_training = models.IntegerField(choices=[[1, '从来没参加过'], [2, '1-4次'], [3, '5次及以上'], [4, '6-10次']], label='18.您有参加过英语课外辅导或英语培训中心吗?', widget=widgets.RadioSelectHorizontal) read_fluency = models.IntegerField(choices=[[1, '完全不流利'], [2, '比较不流利'], [3, '介于流利与不流利之间'], [4, '比较流利'], [5, '完全流利']], label='19.您能流利的朗读目前英语课书本上的文章和单词吗?', widget=widgets.RadioSelectHorizontal) certificate = models.StringField(label='20.您是否考取了英语相关的证书(四级、六级、专四、专八等)?请在下列方框中填写相关证书及对应分数。如:四级600。(若没有任何证书,请填无)') exchange = models.IntegerField(choices=[[0, '否'], [1, '是']], label='21.您是否出国交流学习过(欧美国家的大学)?', widget=widgets.RadioSelectHorizontal) experiment_before = models.IntegerField(choices=[[0, '否'], [1, '是']], label='22.您是否参加过类似的实验(经济学实验或心理学实验)? ', widget=widgets.RadioSelectHorizontal) identity = models.IntegerField(choices=[[1, '学生'], [2, '教职工'], [3, '其他']], label='23.您的在校身份是?(不影响实验报酬发放)', widget=widgets.RadioSelectHorizontal) comments = models.LongStringField(label='24.您对我们的实验有哪些建议?') chosen_trial = models.IntegerField(initial=1) payoff1 = models.FloatField() payoff2 = models.FloatField() TEL2 = models.StringField(label='电话号码') Alipay2 = models.IntegerField(label='支付宝账号') class Survey(Page): form_model = 'player' form_fields = ['gender', 'only_child', 'age', 'college', 'grade', 'major', 'origin', 'consumption', 'understand', 'accurate_decisions', 'fuzzy_decision', 'english_level', 'second_foreign_language1', 'second_foreign_language2', 'start_english', 'english_reading', 'TV_series', 'english_training', 'read_fluency', 'certificate', 'exchange', 'experiment_before', 'comments', 'consideration', 'identity'] @staticmethod def before_next_page(player, timeout_happened): participant = player.participant import random player.chosen_trial=random.randint(1,12) if player.chosen_trial==1: player.payoff1=player.participant.vars['trial1'] elif player.chosen_trial==2: player.payoff1=player.participant.vars['trial2'] elif player.chosen_trial==3: player.payoff1=player.participant.vars['trial3'] elif player.chosen_trial==4: player.payoff1=player.participant.vars['trial4'] elif player.chosen_trial==5: player.payoff1=player.participant.vars['trial5'] elif player.chosen_trial==6: player.payoff1=player.participant.vars['trial6'] elif player.chosen_trial==7: player.payoff1=player.participant.vars['trial7'] elif player.chosen_trial==8: player.payoff1=player.participant.vars['trial8'] elif player.chosen_trial==9: player.payoff1=Constants.trail9 elif player.chosen_trial==10: player.payoff1=player.participant.vars['trial10'] elif player.chosen_trial==11: player.payoff1=player.participant.vars['trial11'] else: player.payoff1=player.participant.vars['trial12'] player.payoff2=player.payoff1+Constants.appearance_fee class Payoff_CN(Page): form_model = 'player' form_fields = ['TEL2', 'Alipay2'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True class Payoff_en(Page): form_model = 'player' form_fields = ['TEL2', 'Alipay2'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False class Ending(Page): form_model = 'player' page_sequence = [Survey, Payoff_CN, Payoff_en, Ending]