import random from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'sample' PLAYERS_PER_GROUP = None TASKS = ['A','B','C','D','E','F','G','H','I'] NUM_ROUNDS = len(TASKS) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): def Sekkachi(label): return models.IntegerField( choices=[[0,'全くそうではない'],[1,'ほとんどそうではない'],[2,'あまりそうではない'],[3,'ややそうである'],[4,'かなりそうである'],[5,'全くそうである'],[6,'わからない']], label=label, widget=widgets.RadioSelect ) def Douchou(label): return models.IntegerField( choices=[[0,'当てはまらない'],[1,'あまり当てはまらない'],[2,'どちらでもない'],[3,'少し当てはまる'],[4,'当てはまる']], label=label, widget=widgets.RadioSelect ) def Tokuchu(label): return models.IntegerField( choices=[[0,'当てはまらない'],[1,'あまり当てはまらない'],[2,'どちらでもない'],[3,'少し当てはまる'],[4,'当てはまる']], label=label, widget=widgets.RadioSelect ) age =models.IntegerField(label='あなたの年齢をお選びください', choices=[[0,'18'],[1,'19'],[2,'20'],[3,'21'],[4,'22'],[5,'23'],[6,'24']] ) year=models.StringField(label='あなたの学年をお選びください', choices=[[0,'1'],[1,'2'],[2,'3'],[3,'4'],[4,'5'],[5,'6']] ) faculty=models.StringField(label='あなたの学科をお選びください', choices=[[0,'日本文学科'],[1,'書道学科'],[2,'英語英米文学科'],[3,'児童教育学科'],[4,'現代心理学科'],[5,'ビジネス心理学科'],[6,'現代ビジネス学科'],[7,'国際観光ビジネス学科'],[8,'公共経営学科'],[9,'生活デザイン学科'],[10,'管理栄養学科'],[11,'造形デザイン学科'],[12,'薬学科'],[13,'看護学科'],[14,'保育科']] ) parttime_year=models.IntegerField(label='あなたのアルバイト経験年数をお書きください
(複数ある場合は一番長くやっているものをご回答下さい)
', choices=[[0,'1ヶ月以内'],[1,'1ヶ月〜6ヶ月'],[2,'6ヶ月〜1年'],[3,'1年以上'],[4,'やっていない']], widget=widgets.RadioSelect ) regis_year=models.IntegerField(label='あなたのレジ打ち経験年数をお書きください
(複数ある場合は一番長くやっているものをご回答下さい)
', choices=[[0,'1ヶ月以内'],[1,'1ヶ月〜6ヶ月'],[2,'6ヶ月〜1年'],[3,'1年以上'],[4,'やったことがない']], widget=widgets.RadioSelect ) SQ1 = Sekkachi('焦りを感じやすい方である') SQ2 = Sekkachi('過ぎてしまったことをいつまでもくよくよ考えることが多い') SQ3 = Sekkachi('時間が経つのが気になる方である') SQ4 = Sekkachi('毎日が時間に追いかけられているようだ') SQ5 = Sekkachi('将来のことについていろいろ気になることが多い') SQ6 = Sekkachi('何をするにもせっかちである') SQ7 = Sekkachi('やらなければならないことをするのに十分な時間がないと感じることが多い') SQ8 = Sekkachi('やり残していることが多いように思う') SQ9 = Sekkachi('昔は良かったと思うことが多い') SQ10 = Sekkachi('人に待たされるとすぐにイライラする') SQ11 = Sekkachi('自分はのんびりや(楽天家)である') DQ1 = Douchou('集団で話し合ったり何かするときは,率先して自分の意見を言う方だ ') DQ2 = Douchou('私は,グループに対して反対意見を容易に言うことができる ') DQ3 = Douchou('たとえ納得できなくても,しかたなく周りにあわせてしまうことが多い ') DQ4 = Douchou('周囲の反応が気になってしまって,本心と違うことでも,周りの人に合わせて同意してしまうことがよくある ') DQ5 = Douchou('友人と一緒に何かするときには,たいてい友人のほうが物事を決める ') DQ6 = Douchou('周りの考えがどうであろうと,自分の考えを押し通すほうだ ') DQ7 = Douchou('仲間の中で,自分だけ意見が違うと不安になる ') DQ8 = Douchou('場を乱さないように,いろいろと人に合わせてしまうことが多い ') DQ9 = Douchou('私は,たとえそれが自分の信じていないことであってもグループに賛成する ') DQ10 = Douchou('私はグループの基準に従いがちである ') DQ11 = Douchou('みんなの中でなかなか自分を出せないと思うことがある ') DQ12 = Douchou('私は容易には他者に従わない ') DQ13 = Douchou('グループに従うくらいなら,むしろ独立した方がよい ') DQ14 = Douchou('自分の意見が他者と一致すると,とても安心する ') DQ15 = Douchou('自分の考えよりも,他者の判断の方が気になってしまう ') DQ16 = Douchou('誰かの意見に非常に説得力があるなら,私は自分の意見をかえて,その人と協力する ') TQ1_Large = Tokuchu('レジに並び始めている人達を見かけたら、自分もレジに並ぼうとする') TQ2_Large = Tokuchu('レジに列が見えたら、列がなくなるまで店内を見て回る') TQ3_Large = Tokuchu('買い物をしているときに列に並ぶことは嫌い') TQ1_Small = Tokuchu('レジに並び始めている人達を見かけたら、自分もレジに並ぼうとする') TQ2_Small = Tokuchu('レジに列が見えたら、列がなくなるまで店内を見て回る') TQ3_Small = Tokuchu('買い物をしているときに列に並ぶことは嫌い') TQ1_Rest = Tokuchu('レジに並び始めている人達を見かけたら、自分もレジに並ぼうとする') TQ2_Rest = Tokuchu('レジに列が見えたら、列がなくなるまで席で待つ') TQ3_Rest = Tokuchu('会計のときに列に並ぶことは嫌い') pan10_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?', choices=[[1,'1'],[2,'2'],[3,'3'],[4,'4'],[5,'5'],[6,'6'],[7,'7'],[8,'8'],[9,'9'],[10,'10']] ) pan20_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?', choices=[[1,'1'],[2,'2'],[3,'3'],[4,'4'],[5,'5'],[6,'6'],[7,'7'],[8,'8'],[9,'9'],[10,'10'],[11,'11'],[12,'12'],[13,'13'],[14,'14'],[15,'15'],[16,'16'],[17,'17'],[18,'18'],[19,'19'],[20,'20']] ) pan30_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?', choices=[[1,'1'],[2,'2'],[3,'3'],[4,'4'],[5,'5'],[6,'6'],[7,'7'],[8,'8'],[9,'9'],[10,'10'],[11,'11'],[12,'12'],[13,'13'],[14,'14'],[15,'15'],[16,'16'],[17,'17'],[18,'18'],[19,'19'],[20,'20'],[21,'21'],[22,'22'],[23,'23'],[24,'24'],[25,'25'],[26,'26'],[27,'27'],[28,'28'],[29,'29'],[30,'30']] ) Super10_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?', choices=[[1,'1'],[2,'2'],[3,'3'],[4,'4'],[5,'5'],[6,'6'],[7,'7'],[8,'8'],[9,'9'],[10,'10']] ) Super20_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?', choices=[[1,'1'],[2,'2'],[3,'3'],[4,'4'],[5,'5'],[6,'6'],[7,'7'],[8,'8'],[9,'9'],[10,'10'],[11,'11'],[12,'12'],[13,'13'],[14,'14'],[15,'15'],[16,'16'],[17,'17'],[18,'18'],[19,'19'],[20,'20']] ) Super30_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?', choices=[[1,'1'],[2,'2'],[3,'3'],[4,'4'],[5,'5'],[6,'6'],[7,'7'],[8,'8'],[9,'9'],[10,'10'],[11,'11'],[12,'12'],[13,'13'],[14,'14'],[15,'15'],[16,'16'],[17,'17'],[18,'18'],[19,'19'],[20,'20'],[21,'21'],[22,'22'],[23,'23'],[24,'24'],[25,'25'],[26,'26'],[27,'27'],[28,'28'],[29,'29'],[30,'30']] ) Zakka10_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?', choices=[[1,'1'],[2,'2'],[3,'3'],[4,'4'],[5,'5'],[6,'6'],[7,'7'],[8,'8'],[9,'9'],[10,'10']] ) Zakka20_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?', choices=[[1,'1'],[2,'2'],[3,'3'],[4,'4'],[5,'5'],[6,'6'],[7,'7'],[8,'8'],[9,'9'],[10,'10'],[11,'11'],[12,'12'],[13,'13'],[14,'14'],[15,'15'],[16,'16'],[17,'17'],[18,'18'],[19,'19'],[20,'20']] ) Zakka30_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?', choices=[[1,'1'],[2,'2'],[3,'3'],[4,'4'],[5,'5'],[6,'6'],[7,'7'],[8,'8'],[9,'9'],[10,'10'],[11,'11'],[12,'12'],[13,'13'],[14,'14'],[15,'15'],[16,'16'],[17,'17'],[18,'18'],[19,'19'],[20,'20'],[21,'21'],[22,'22'],[23,'23'],[24,'24'],[25,'25'],[26,'26'],[27,'27'],[28,'28'],[29,'29'],[30,'30']] ) def creating_session(subsession:Subsession): if subsession.round_number == 1: for p in subsession.get_players(): round_numbers = list(range(1,C.NUM_ROUNDS+1)) random.shuffle(round_numbers) p.participant.vars['task_rounds'] = dict(zip(C.TASKS, round_numbers)) # PAGES class MyPage(Page): form_model='player' form_fields=['SQ1','SQ2','SQ3','SQ4','SQ5','SQ6','SQ7','SQ8','SQ9','SQ10','SQ11'] @staticmethod def is_displayed(player): return player.round_number == 1 class Intro(Page): @staticmethod def is_displayed(player): return player.round_number == 1 class Results(Page): form_model='player' form_fields=['DQ1','DQ2','DQ3','DQ4','DQ5','DQ6','DQ7','DQ8','DQ9','DQ10','DQ11','DQ12','DQ13','DQ14','DQ15','DQ16'] @staticmethod def is_displayed(player): return player.round_number == 1 class Tokuchu(Page): form_model='player' form_fields=['TQ1_Large','TQ2_Large','TQ3_Large','TQ1_Small','TQ2_Small','TQ3_Small','TQ1_Rest','TQ2_Rest','TQ3_Rest'] @staticmethod def is_displayed(player): return player.round_number == 9 class Demographic(Page): form_model='player' form_fields=['age','year','faculty','parttime_year','regis_year'] @staticmethod def is_displayed(player): return player.round_number == 9 class End(Page): @staticmethod def is_displayed(player): return player.round_number == 9 class Pan10(Page): form_model='player' form_fields=['pan10_ninnzu'] @staticmethod def is_displayed(player: Player): return player.round_number == player.participant.vars['task_rounds']['A'] class Pan20(Page): form_model='player' form_fields=['pan20_ninnzu'] @staticmethod def is_displayed(player: Player): return player.round_number == player.participant.vars['task_rounds']['B'] class Pan30(Page): form_model='player' form_fields=['pan30_ninnzu'] @staticmethod def is_displayed(player: Player): return player.round_number == player.participant.vars['task_rounds']['C'] class Super10(Page): form_model='player' form_fields=['Super10_ninnzu'] @staticmethod def is_displayed(player: Player): return player.round_number == player.participant.vars['task_rounds']['D'] class Super20(Page): form_model='player' form_fields=['Super20_ninnzu'] @staticmethod def is_displayed(player: Player): return player.round_number == player.participant.vars['task_rounds']['E'] class Super30(Page): form_model='player' form_fields=['Super30_ninnzu'] @staticmethod def is_displayed(player: Player): return player.round_number == player.participant.vars['task_rounds']['F'] class Zakka10(Page): form_model='player' form_fields=['Zakka10_ninnzu'] @staticmethod def is_displayed(player: Player): return player.round_number == player.participant.vars['task_rounds']['G'] class Zakka20(Page): form_model='player' form_fields=['Zakka20_ninnzu'] @staticmethod def is_displayed(player: Player): return player.round_number == player.participant.vars['task_rounds']['H'] class Zakka30(Page): form_model='player' form_fields=['Zakka30_ninnzu'] @staticmethod def is_displayed(player: Player): return player.round_number == player.participant.vars['task_rounds']['I'] page_sequence = [Intro, MyPage, Results, Pan10, Pan20, Pan30, Super10, Super20, Super30, Zakka10, Zakka20, Zakka30, Tokuchu, Demographic, End]