import random from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'Tanimoto_Q' 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 ) code = models.StringField() age =models.IntegerField(label='あなたの年齢をお選びください', choices=[[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'],[31,'31'],[32,'32'],[33,'33'],[34,'34'],[35,'35'],[36,'36'],[37,'37'],[38,'38'],[39,'39'], [40,'40'],[41,'41'],[42,'42'],[43,'43'],[44,'44'],[45,'45'],[46,'46'],[47,'47'],[48,'48'],[49,'49'], [50,'50'],[51,'51'],[52,'52'],[53,'53'],[54,'54'],[55,'55'],[56,'56'],[57,'57'],[58,'58'],[59,'59'], [60,'60'],[61,'61'],[62,'62'],[63,'63'],[64,'64'],[65,'65'],[66,'66'],[67,'67'],[68,'68'],[69,'69'], [70,'70'],[71,'71'],[72,'72'],[73,'73'],[74,'74'],[75,'75'],[76,'76'],[77,'77'],[78,'78'],[79,'79'], [80,'80'],[81,'81'],[82,'82'],[83,'83'],[84,'84'],[85,'85'],[86,'86'],[87,'87'],[88,'88'],[89,'89'], [90,'90'],[91,'91'],[92,'92'],[93,'93'],[94,'94'],[95,'95'],[96,'96'],[97,'97'],[98,'98'],[99,'99']] ) sex=models.StringField(label='あなたの性別をお選びください', choices=[[0,'女性'],[1,'男性'],[2,'その他']] ) d4 = models.IntegerField(label=' あなたの最終学歴を次のうちからお選びください', choices=[[1,'中学校'],[2,'高校'],[3,'短大・高専・専門学校'],[4,'大学'],[5,'大学院']]) d5 = models.IntegerField(label=' あなたは現在、結婚していますか。当てはまるものをお選びください', choices=[[1,'未婚'],[2,'離婚、死別'],[3,'既婚(パートナーとの同居を含む)']]) d6 = models.IntegerField(label=' 現在同居なさっているご家族は何人ですか。あなた自身を含めた人数をお選びください',min=1, max=20,choices=list(range(1,21))) d7 = models.IntegerField(label='あなたの現在の雇用状況にもっとも当てはまるものをお選びください', choices=[[1,'正規雇用'],[2,'アルバイト・派遣社員'],[3,'自営業'],[4,'失業して1年以上'],[5,'失業して1年以内'], [6,'主婦・主夫'],[7,'学生'],[8,'退職'],[9,'労働が困難な状況にある']]) # 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']] ) Super_ninnzu = models.IntegerField(label='何人のお客さんがレジに並んだらあなたもレジに並びますか?下の空欄に数字を入力してください。', ) def creating_session(subsession:Subsession): import random, string for player in subsession.get_players(): r = ''.join(random.choices(string.ascii_letters + string.digits, k=5)) player.code = r 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','sex','d4','d5','d6','d7',] @staticmethod def is_displayed(player): return player.round_number == 9 class End(Page): form_model = "player" form_fields = ["code",] @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 Super(Page): form_model='player' form_fields=['Super_ninnzu'] @staticmethod def is_displayed(player): return player.round_number == 9 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, Super, Tokuchu, Demographic, End]