from otree.api import * class C(BaseConstants): NAME_IN_URL = 'survey' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 #course = ['principle', 'intermediate', 'game', 'theory', 'exp'] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.IntegerField(label='你的年齡是:', min=17, max=99, required = True) gender = models.StringField( choices=[['Male', '生理男'], ['Female', '生理女'], ['Other', '其他']], label='你的生理性別是:', widget=widgets.RadioSelect, required = True ) blood_type = models.StringField( choices=[['A', 'A型'], ['B', 'B型'], ['O', 'O型'], ['AB', 'AB型'], ['Other', '其他']], label='你的血型是:', required = True ) identity = models.BooleanField( choices=[['True', '台灣本地生'], ['False', '非台灣本地生(例如:僑生、外籍交換學生等)']], label='你是否為台灣本地生?', widget=widgets.RadioSelect, required = True ) grade = models.StringField( choices=[['1', '大學部1年級'], ['2', '大學部2年級'], ['3', '大學部3年級'], ['4', '大學部4年級'], ['5', '大學部5年級以上'], ['6', '碩士班'], ['7', '博士班'], ['8', '其他']], label='你的系級是:', required = True ) #from django.core.validators import MinLengthValidator #class Volume(models.Model): #department = models.CharField('Volume Number', max_length=4, validators=[MinLengthValidator(4)]) department = models.StringField( label='你的學號第四至七碼是:', #max_length = 4, required = True, ) #number_of_courses = models.StringField( # choices=[['1', '個體經濟學原理(原經濟學原理與實習上)'], ['2', '個體經濟學'], ['3', '賽局論'], ['4', '個體經濟理論(僅限經濟系選修)'], ['5', '實驗經濟學']], # label='請問你目前為止修過幾堂經濟學相關課程?', #) decision_rule = models.StringField( label='請問在實驗過程中,你是如何決定「繼續」或「停下」?', required = True ) principle = models.BooleanField( choices=[['True', '是'], ['False', '否']], label='你是否修過個體經濟學原理(原經濟學原理與實習上)?', widget=widgets.RadioSelect, required = True ) intermediate = models.BooleanField( choices=[['True', '是'], ['False', '否']], label='你是否修過個體經濟學?', widget=widgets.RadioSelect, required = True ) game = models.BooleanField( choices=[['True', '是'], ['False', '否']], label='你是否修過賽局論(限經濟系選修)?', widget=widgets.RadioSelect, required = True ) theory = models.BooleanField( choices=[['True', '是'], ['False', '否']], label='你是否修過個體經濟理論?', widget=widgets.RadioSelect, required = True ) exp = models.BooleanField( choices=[['True', '是'], ['False', '否']], label='你是否修過實驗經濟學?', widget=widgets.RadioSelect, required = True ) # possible solution for multiple choices:(中文無法顯示) #https://s3.amazonaws.com/otreehub/browsable_source/1e38462b-46c7-4ca1-bca5-536462f90131/multi_select/index.html # demand_effect = models.StringField( # label='請你猜測本實驗的目的為何:', # ) def department_error_message(player, value): if len(value) != 4: return '請輸入一組四位數的系所代碼!' # FUNCTIONS # PAGES class Exp_survey1(Page): form_model = 'player' form_fields = ['age','gender','blood_type','identity','grade','department','decision_rule'] @staticmethod def is_displayed(player:Player): participant = player.participant return participant.drop == False class Exp_survey2(Page): form_model = 'player' form_fields = ['principle', 'intermediate', 'theory', 'game', 'exp'] @staticmethod def is_displayed(player:Player): participant = player.participant return participant.drop == False class personal_account(Page): @staticmethod def is_displayed(player:Player): participant = player.participant return participant.drop == False class message(Page): @staticmethod def is_displayed(player:Player): participant = player.participant return participant.drop == True page_sequence = [Exp_survey1, Exp_survey2, message, personal_account, ]