from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'aftergacha' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): #number_of_wish = models.IntegerField() #number_of_win = models.IntegerField() #number_of_remaining_token = models.IntegerField() #number_of_payment = models.FloatField() age = models.IntegerField(label='What is your age?', min=18, max=125) gender = models.StringField( choices=[['0', 'Male'], ['1', 'Female'] ], label='What is your biological gender?', widget=widgets.RadioSelect, ) culture = models.StringField( choices=[['0', 'White'], ['1', 'Black'], ['2', 'Asian'], ['3', 'Hispanic'], ['4', 'Other'] ], label='What is your racial identity?', widget=widgets.RadioSelect, ) education = models.StringField( choices=[['0', 'Primary school or below'], ['1', 'junior high school or equivalent'], ['2', 'senior high school or equivalent'], ['3', 'Undergraduate education or equivalent'], ['4', 'Graduate education or equivalent'] ], label='What is your education level?', widget=widgets.RadioSelect, ) marriage = models.StringField( choices=[['0', 'Not ever married'], ['1', 'Married'], ['2', 'Divorced'], ['3', 'Not Divorced but live apart'], ['4', 'I do not want to say'] ], label='What is your marriage situation?', widget=widgets.RadioSelect, ) personincome = models.StringField( choices=[['0', '$15k or below'], ['1', '$15k to $50k'], ['2', '$50k to 100k'], ['3', '$100k to $150k'], ['4', '$150k to $200k'], ['5', '$200k or above'], ['6', 'I do not want to say'] ], label='What is your annual personal income level?', widget=widgets.RadioSelect, ) familyincome = models.StringField( choices=[['0', '$15k or below'], ['1', '$15k to $50k'], ['2', '$50k to 100k'], ['3', '$100k to $150k'], ['4', '$150k to $200k'], ['5', '$200k or above'], ['6', 'I do not want to say'] ], label='What is your annual family income level?', widget=widgets.RadioSelect, ) children = models.StringField( choices=[['0', '0'], ['1', '1'], ['2', '2'], ['3', '3'], ['4', '4 or above'], ['5', 'I do not want to say'] ], label='How many children do you have?', widget=widgets.RadioSelect, ) liveparent = models.StringField( choices=[['0', 'Yes'], ['1', 'No'] ], label='Do you live with your parents?', widget=widgets.RadioSelect, ) livechildren = models.StringField( choices=[['0', 'Yes'], ['1', 'No'] ], label='Do you live with your children?', widget=widgets.RadioSelect, ) live = models.StringField( choices=[['0', 'Yes'], ['1', 'No'] ], label='Do you live in the region where your ethnic group normally live? (i.e. Japanese live in Japan)', widget=widgets.RadioSelect, ) emotion = models.StringField( choices=[['0', 'Yes'], ['1', 'No'], ['2', 'Indifference'] ], label='Do you feel fair to get the 1000 token from the first survey? ', widget=widgets.RadioSelect, ) attitude_lottery = models.StringField( choices=[['0', 'Attractive'], ['1', 'Boring'], ['2', 'Indifference'] ], label='How do you feel about this lottery? ', widget=widgets.RadioSelect, ) number_lottery = models.IntegerField(label='How many lottery you plan to buy before you start to buy?', min=0, max=100) number_win = models.IntegerField(label='How many times you expect to win?', min=0, max=100) real_lottery = models.StringField( choices=[['0', 'Yes'], ['1', 'No'], ], label='Have you ever bought lottery in the real world? ', widget=widgets.RadioSelect, ) real_win = models.IntegerField(label='How many times you win in real world? (0 if not)', min=0, max=10000000) number_prize = models.IntegerField(label='How many prize (worth in dollar) you win in real world? (0 if not)', min=0, max=10000000) game_1 = models.StringField( choices=[['0', 'Yes'], ['1', 'No'], ], label='Have you ever played video game or PC game? ', widget=widgets.RadioSelect, ) game_2 = models.StringField( choices=[['0', 'Yes'], ['1', 'No'], ], label='Have you ever played cell phone game (Ipad also included)? ', widget=widgets.RadioSelect, ) game_3 = models.StringField( choices=[['0', 'Yes'], ['1', 'No'], ], label='Have you ever played video game or PC game with any gambling reward system? (pay money to get random item)? ', widget=widgets.RadioSelect, ) game_4 = models.StringField( choices=[['0', 'Yes'], ['1', 'No'], ], label='Have you ever played cell phone game with any gambling reward system? (pay money to get random item) ', widget=widgets.RadioSelect, ) game_5 = models.StringField( choices=[['0', 'Yes'], ['1', 'No'], ], label='Have you ever played video game or PC game with both gambling reward system and pity system?', widget=widgets.RadioSelect, ) game_6 = models.StringField( choices=[['0', 'Yes'], ['1', 'No'], ], label='Have you ever played cell phone game with both gambling reward system and pity system?', widget=widgets.RadioSelect, ) money_game = models.IntegerField(label='How many dollars you have spent on gamble system in games in total?(0 if not)', min=0, max=10000000) choice = models.StringField( choices=[['0', 'Gambling game with pity system'], ['1', 'Gambling game without pity system'], ], label='If you have to spend some money in electronic game, which kind of game do you prefer?', widget=widgets.RadioSelect, ) heard = models.StringField( choices=[['0', 'Yes, positive news'], ['1', 'Yes, negative'], ['2', 'No'] ], label='Have you ever heard news about gamble in electronic game? ', widget=widgets.RadioSelect, ) attitude_game = models.StringField( choices=[['0', 'Positive'], ['1', 'Negative'], ['2', 'Indifference'] ], label='How do you feel about the gamble or gambling system in electronic game? ', widget=widgets.RadioSelect, ) meaning = models.StringField(label='Do you know the meaning of this study? If yes, please briefly describe it.') # PAGES class Result(Page): form_model = 'player' #def before_next_page(player, timeout_happened): #player.number_of_wish = player.participant.total_wish #player.number_of_win = player.participant.total_win #player.number_of_remaining_token = player.participant.remaining_diamond #player.number_of_payment = player.participant.payment def vars_for_template(player: Player): player.participant.payment =round((player.participant.payment)/500,2) + player.participant.showup return dict( total_wish = player.participant.total_wish, total_win = player.participant.total_win, remaining_token = player.participant.remaining_diamond, showup = player.participant.showup, payment = player.participant.payment, ) class Survey1(Page): form_model = 'player' form_fields = ['age', 'gender','culture','live','emotion'] class Survey2(Page): form_model = 'player' form_fields = ['education','marriage','personincome','familyincome','children','livechildren','liveparent'] class Survey3(Page): form_model = 'player' form_fields = ['attitude_lottery', 'number_lottery','number_win','real_lottery','real_win','number_prize'] class Survey4(Page): form_model = 'player' form_fields = ['game_1', 'game_2','game_3','game_4','game_5','game_6','money_game','choice','heard','attitude_game','meaning'] def before_next_page(player, timeout_happened): player.participant.finished = True page_sequence = [Result, Survey1, Survey2, Survey3, Survey4]