From 80da247b8d29a7a51b886cbe000285f24eab03b2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 26 Jul 2019 17:44:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_competition_enroll_list.html.erb | 2 +- ...9_add_team_member_for_competition_teams.rb | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20190726085129_add_team_member_for_competition_teams.rb diff --git a/app/views/managements/_competition_enroll_list.html.erb b/app/views/managements/_competition_enroll_list.html.erb index 6b67f3b1..6658f57b 100644 --- a/app/views/managements/_competition_enroll_list.html.erb +++ b/app/views/managements/_competition_enroll_list.html.erb @@ -33,7 +33,7 @@ <%= member_user.try(:authentication_status) %> <%= member_user.try(:professional_status) %> <%= member_user.try(:school_name) %> - <%= member_user.user_extensions.school.try(:province) %> + <%= member_user.user_extensions.try(:school).try(:province) %> <%= format_time member.created_at %> <% end %> diff --git a/db/migrate/20190726085129_add_team_member_for_competition_teams.rb b/db/migrate/20190726085129_add_team_member_for_competition_teams.rb new file mode 100644 index 00000000..5705281d --- /dev/null +++ b/db/migrate/20190726085129_add_team_member_for_competition_teams.rb @@ -0,0 +1,27 @@ +class AddTeamMemberForCompetitionTeams < ActiveRecord::Migration + def up + def generate_team_code + code = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z).sample(6).join + return generate_team_code if CompetitionTeam.where(invite_code: code).present? + code + end + + user_ids = User.where(is_test: true).pluck(:id) + while(user_ids.length > 0) + users = user_ids.pop(rand(3..5)) + invite_code = generate_team_code + puts("#{invite_code}"); + new_team = CompetitionTeam.create!(:competition_id => 6, :name => "daiao#{users[0]}", + :invite_code => invite_code, :user_id => users[0]) + users.each_with_index do |u, index| + role = index == 0 ? 1 : 0 + is_teacher = index == 0 ? 1 : 0 + new_team.team_members.create!(user_id: u, role: role, competition_id: 6, + is_teacher: is_teacher) + end + end + end + + def down + end +end From 4070ff98c5c31c5d00239facd3ce4baa70ec57c1 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 26 Jul 2019 18:06:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...26085129_add_team_member_for_competition_teams.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/db/migrate/20190726085129_add_team_member_for_competition_teams.rb b/db/migrate/20190726085129_add_team_member_for_competition_teams.rb index 5705281d..2c7852d0 100644 --- a/db/migrate/20190726085129_add_team_member_for_competition_teams.rb +++ b/db/migrate/20190726085129_add_team_member_for_competition_teams.rb @@ -5,13 +5,21 @@ class AddTeamMemberForCompetitionTeams < ActiveRecord::Migration return generate_team_code if CompetitionTeam.where(invite_code: code).present? code end + def user_team_name + name = "谁与争锋,水阳乐升战队,乱世群星,圣罗兰战队,神族战队,殇之舞,古或仔社团,炫魄战队,super潮流,不灭皇朝,背叛者联盟,ve皇族战队,特狐《秒杀》*火,超级时▽空战队,callmedeath,卜娃娃,妇丑者联盟,Top娱乐战队,蜀mars战队,JS铱埘绱,经典极炫帝国,No嚣张,total不想长大,廾Wudi双胞胎,魔夜战队,Super战队,卩Fly战队,中国好队友,蓝天之巅,Vshow概念,棒棒糖ok,川型男嗦囡站,艹巴黎田园,天朝有关部门,夯族狠爱祢,Fly战队,esc战士,tk莳绱,卩茗人e族,{祖鞍战队,XX地区城管大队,ii皇族Team,mumateam,帝国觉醒梦之队,sdu天娇团,浪漫个性BabY,战神战队,宠物恋梦之队,至尊情侣,Mu龙凤堂,Sky夜qqkiss,嗜血家族,Dream永恒,神秘╋社团,—皇军—{`八路},VIP家族,唯你专属,m战队,伊波吕帝王,紫色天堂,柒彩战堂,宠儿恋战队,京城纳兰皇族毁灭,徽府__战队,单纯deTeam,雨后sunlight家族,Crazy_雪豹,peak巅峰之神,浪漫情侣qqkiss,蜀Mars战队,群帝ヌ№ヒ天下,中国好队友,xx迁队,精渶戰隊,t黔堂战队,天雷vs地火,对面师太别走,云轩阁战队,裂空☆精英☆部队,Pk蛊惑堂,特狐《秒杀》*火,vip冻结完美,emule世家,≮╰不留人※,星当家Team,瞬间迷茫,TOP堡龙E族,风暴飞飞战队,红十字爱心战队,doley霸气,loveTeaM,kiss夜店,落寞英雄|引领,Gold战队,秘密战队五连者,Duck蔚蓝族,闲情居朝廷,TK莳绱,羽翼神之战队,雄霸天下,时尚天使,战神战队,FRAT战队,FoX杀破狼,Ferrari腾飞,经典极炫帝国,Sea大连盟SkY,主打歌,名人社团,艹jack魔团,宝贝mayY战队,XX拆迁队,豆豆部落,pico巅峰战队,冰魂v紫魄,穿越腾讯,HZ西湖战队,川全f最嗨o,义博云天E族,royal皇朝,SuiYa战队,名人榜耀队,Man卟酷派,死亡诗社》,memory皇族,单恋家族,鬼式战队,梦DE国度,RoyalTeam,milk口milk学院,型男嗦囡站,美的伤人o,卩玉缳Team,亚洲乄独霸,燃烧嗜血大队,Cherish断点,feng暴领域,Paoniu小嘴乱qqkiss,Fe飞车一簇Pass,嗤古战队,叛逆无罪家族,咸鱼大队,Kle战队,皇朝俱乐部,绝杀一族,十二星座,中国好队友,封神榜,新疆战队,marshal兄弟,ThePink,狂拽e族战队,Es艹新势力,狂飙潮汕战队,对面师太别走,ZooM悲殇入侵,赛斯佣兵团,逍遥紫钻贵族,兄弟帮Team,crazy狂飙zu,纵横天下,水月轩颠峰之城,幻境贵族,卩爷仼锗归莱,绝世神骚,广东Win战队,背叛者联盟,乱世名流站队,Niki龙堂,狂拽E族战队,闪耀team,古或仔社团,高级飞车,星当家Team,火线敢死队,绝世神骚,宠儿恋,Peak巅峰之神,瞬间迷茫,那爱狠美yEs,Pico巅峰战队,Bubble战队,人民解放军驻美部队,逆天浪子,黑夜神话,绝世神骚,蜀Mars战队,灵异艹战神霸主,HAPPY纯属鱼乐,Nice兄弟情,群帝ヌ№ヒ天下,SilentTopTeam,风暴飞飞战队,艹巅峰战队,loveTeaM,茗人堂战魂,赞美b,颤抖吧妹纸,Es艹新势力,㈱◎连⑨族,Duck蔚蓝族,MumaTeam,XX地区城管大队,炫请深爱,颠覆想像,少年先锋队,Spurt俱乐部,NBA明星,艹o羡世,晨曦战队,Top娱乐战队,单纯deTeam,卩爷仼锗归莱,Viva摇摆全F,大湿战队,老纳战队,Esc战士,ii街头式yes,中国好队友,Sdu天娇团,total不想长大,五星荭旗,暧昧Forever,Shmily缘,DevilClub,roc战堂,灵异艹战神霸主,AKillerClub,单恋家族,劳资茗星战队,marshal龙战,黑道学生,艹Kiss糖果屋,绝世骚神,紫色天堂,风云重庆,神话明星艹,iiFire艹永远,川奶糖代言,dw皇朝,川yellow暴力,Sel神话情,Jamw战队,o埘绱ovIp荣耀,魔羯子弹,Dream永恒,霸王战队づ,艹当红世家,水阳乐升战队,辉煌之巅,幻境贵族,◇霸剑皇侯,Crazy狂飙zu,Lucky至尊,拓海Team,世外桃源,Melody战队,乱世霸者,◇霸剑皇侯,Storm风暴俱乐部,兄弟帮Team,神话-东城衞,千年春梦之队,对面菊花洗干净,i淫领潮流o,XX拆迁队,Xo情谊Team,闷骚小分队,rp℃战队,闲情居朝廷,Zero量版集团,惊动党中央,丬nicE学生会艹,茗牌货集团,星球狂想战队,隐龙天下,卩顶尖儚徔队,eoe战队,奇异夸克团,GTR炫主力战队,颠覆想像,奶糖代言,飞车集团,鸟人战队,NBA明星,嗜血禁区,x车神x帅哥x战队x,背叛者联盟,傲╃义薄云天,royal皇朝,卩s帝王战队,阝天下会,Drift世家,艹o羡世,No嚣张,极速皇朝战队,呃家,霸气辉煌王朝,上优战队,kiss艹保时捷,FoX杀破狼,五叶神集团,巭孬嫑勥茓夯昆,蹂躏你全队,东方神起神话,yellow暴力,绝版调情Team,Yellow暴力,影魂战队,Taizi皇族,TemPoTopTeam,急速ZX皇族,No嚣张,网隐战争¢,tk莳绱,Eoe战队,BLUE梦幻,Cherry战队,微笑永恒,艹糸祢视觉Show,Super战队,奇异夸克团,穷人族,傲虎战队,后壹队,红十字爱心战队,o泡泡心之谷,Vshow概念,艹糸祢视觉Show,全网走红战队,倾城战队,卩艹炫茗童话,yw起名网,vrsk,拯救女优小组,绝版调情Team,雪狼鲨豹,农民俱乐部,Kle战队,风暴飞飞战队,ant梦染江山,柒彩战堂,海贼王op,zero拭灵族,eMule世家,Muc皇族i,Yellow暴力,ReStarT噬天,Wonder嗳家,五月花经典,Aini冰kissqqkiss,巅峰VS颠峰,Legend战队,GTR炫主力战队,RoyalTeam,火线实战队,浪漫个性BabY,千年春梦之队,离弃v情侣家族,不正常人类研究中心,艹宝贝莪暧迩,飞车集团,五叶神集团,霸气皇族,极限穿越,殇城噬血宫,柒彩战堂,夜舞倾城,闪耀TEAM,spritteam,惊动党中央,黑玫【猎杀】-狂,领衔主演战队,葬魂_辉煌,TemPo空气动力,战魂卫队,全F最嗨o,风暴飞飞战队,gpr梦幻之队,CK战战队,茗门娱乐圈,冰魂v紫魄,HomeTeam,爆菊突击队,古或仔社团,蹂躏你全队,群帝ヌ№ヒ天下,川赞美b,no嚣张,suiya战队,幻境贵族,黑道学生,铭仁堂Team,冲刺NO,o埘绱ovIp荣耀,艹巅峰战队,OD欧弟二队,幻境贵族,芭比娃娃家族,zero拭灵族,瞳祭阁家族,Es艹新势力,Sky辉煌,酷族帮,只抢女人,云轩阁战队,顷国倾城,卩s霸宀娇宀,?star?摄展,年少轻狂刂,名人堂炫队,穷人族,狂刄星空,少年先锋队,fox杀破狼,非主流集团,A名牌货战队,ii华北区域战,M战队,Mx神话天下,Star碰碰战队,追着菊花跑,memory皇族,L霸王花bazhu战神,劳资呐喊时尚,黑骑战队,魔羯子弹,红十字爱心战队,kiss夜店,beyond贵族,情缘恋,artillery群舞,火速霹雳战队,卩艹炫茗童话,瞬间迷茫,Noble顶峰GT,缘定此生Team,紫禁城皇族,first神话,烟火,疯人院俱乐部,廆棂魂战队,smile家族,约锭So幸福,型男嗦囡站,追着幸福跑,royal皇朝,无痕炫队,﹏挥剑断天下,Total不想长大,杀伐联盟,暴头不用枪,风云重庆,zero拭灵族,葫芦娃,蓝狼vvv站队,云轩阁战队,dgl梦之战队,MumaTeam,乱世名流站队,Skyking魅力,爆菊突击队,开元盛世|霸气,职业带妹子,Aini冰kiss吻,death战队,古或仔社团,飞车实战队,Death战队,魔羯子弹,China特种部队,Sunny快乐,经典极炫帝国,Memory皇族,艹兄弟姐妹,ii华北区域战,Vip精英联盟总队,L霸王花bazhu战神,爆菊突击队,King皇朝,冰火炙恋,CK战战队,霸气辉煌王朝,F海浪vip飙车E族,风暴飞飞战队,劳资呐喊时尚,HS黑鲨主力队,堕落家族,东方神起神话,Fly战队,ck战战队,韩日明星艹,zero拭灵族,弹指分天下,幻境贵族,crazytnt,一切随缘总队,sdu巾帼社,LK明星俱乐部,致命メ一刀,鲁娱乐战队,=☆飞虎队☆=,一步一灭,闪耀TEAM,贵族俱乐部,fatesoul灵魂,战神新王朝,大彩笔战队,亡枫灭族,风流后联盟,嘻哈战队,oranage橙色岁月,M战队,怡春院家族,惜缘战队,兄弟堂战队,hometeam,乱世名流站队,宝贝mayy战队,逗比敢死队,宠坏恋梦之队,夯族狠爱祢,果宝战神,血镞┾战队,绝地酷狼,南京EviL艹炫,经典极炫帝国,皇族,Fo吓败神话,皇家贵族战队,happy纯属鱼乐,super战队,广东Win战队,引领先锋,暗空之灵yw,ゞ战狼特攻队,单纯deteam,捍雨卫队,至僔領域,艹宝贝莪暧迩,忍风战队,HAPPY纯属鱼乐,神风无影,无敌狂飙战队,Super战队,影不死战队,Lree爱你没商量,火线敢死队,风流后联盟,鲁娱乐战队,SPEED光速波之队,PoP道具家族,炫魂之队,SkyFly纪年,Ares艹战队,隐龙天下,Drift世家,夜袭寡妇村,颠覆Team,Top顶尖战队,bubble战队,资本总部,Memory皇族,milk口milk学院,飙飙称霸全球,Gold战队,毒°toxic≒壹队,神话-东城衞,阴月※王朝,轩芫々新贵族,Death战队,尕男尕美,sdu巾帼社,晨曦战队,ミ听雨落花,宠物恋梦之队,Melody战队,DGL梦之战队,天雷VS地火,颤抖吧妹纸,发疯者们,神秘╋社团,G名人集团G,KeT皇家站队,mygirlmyboys,Sos男子噤区,卩玉缳Team,zero量版集团,切菜战队,黑道学生,TK莳绱,spurt俱乐部,徽府__战队,拓海Team,xsl联盟,china军魂,魔夜战队,a名牌货战队,TOP堡龙E族,纵横天下,辉煌王朝,Orden战队,老A特种兵,冰魂v紫魄,艹埘绱时尚,古或仔社团,sKyMACAU,名人堂炫队,傲世听雨轩,Noble顶峰GT,霸气靓兰宝贝,*永垂不朽,辉煌联想风,后壹队,风流后联盟,月缘辉时尚车簇,王技术团队,死神顶级集团,Duck蔚蓝族,fcd战队,神话技术队,飞车党战队,__莫相惜,人头收割者,shmily缘,Sky神之队,爆菊基友大队,皇族爱恋,单纯deteam,艹时尚在线,艹man男人帮,super潮流盛典,love厦门战队,颠覆想像,fr娇柔壹队,津VIP龙之队,魔朝霸族,梵音战阁,o埘绱ovIp荣耀,GTR炫主力战队,不正常人类研究中心,№中liān邦,Star碰碰战队,Pk蛊惑堂,江山如此多娇,风徔ゑ速战队,风云争霸,cl☆集团,Bay战队,hd侠客队,eMule世家,纳兰战队,菜茑天堂卩,尨徔戰隊,D调驿站,艹Jack魔团,【灭世圣龙】,Sel神话情,FCD战队,霸气exposed,时尚皇朝宣队,龙头の霸主,晨Baby皇族,super潮流,忠図战队,漂神魔鬼战队,Memory皇族,绝版唯我独尊,廆棂魂戰隊,Fo吓败神话,TemPoTopClub,津爱改装车,上帝神圣幻影,秘密战队五连者,OD欧弟DO,风云争霸,闪耀TEAM,卩巅峰皇朝,ray颠峰战队,白狐vs蓝色幽灵,致命メ一刀,追着幸福跑,snow天雪葬花,A名牌货战队,浪漫个性baby,午夜珍藏版,酷族帮,忠図战队 +狠幸福木家,叛逆无罪家族,Spurt俱乐部,幻世happys,喇叭总部,Crazy狂飙zu,棒棒糖家族,spurt俱乐部,gtr炫主力战队,≌横形无忌s‖,fox杀破狼,Sky夜qqkiss,奶糖代言,枪林弹雨,Ares战队,Kz战堂Tiller,风速极限战队,茉莉花家族,艹Jack魔团,纵横天下,云轩阁战队,梵天家族,霸气靓兰宝贝,型男嗦囡站,颠覆Team,☆轩殿战队,Οo锋芒毕露оΟ,惜缘战队,义薄云天|孤傲,玄魔圣殿塔罗,风云争霸,FoX杀破狼,蜀mars战队,飞车集团,艹kingteam,HZ西湖战队,vshow概念,蒲公英家族,全F最嗨o,mx童话,回龙星队yw,Melody战队,Xo情谊Team,无痕炫队,夜夜活力-,kiss夜店,鳯升阁,路人战队,卟落战队,热血进行曲。,极炫战队,aT盛世集团,幻魂队,HS黑鲨主力队,东方神起,湖北team,||mcc皇家风格℡,绝版家族,影之家族,蓝色星晨,藏贤谷,Ferrari腾飞,Top顶尖战队,興峸神之队,离弃v情侣家族,葬之族,晨曦战队,x车神x帅哥x战队x,Peak巅峰之神,神话-东城衞,香水百合,艹巅峰战队,super战队,Home浅夏,Mx神话天下,男佐女佑,群帝ヌ№ヒ天下,馨月醉心vs遥,韩日明星艹,新势力战神,隐龙天下,dominance☆绝代,尨徔战队,JS铱埘绱,帅哥x战队x,风暴飞飞战队,super潮流,浪漫个性BabY,信仰与性痒,loveTeaM,残血家族,a名牌货战队,柒彩战堂,风流后联盟,神锋暗杀队,美式荭人镗,后壹队,紫夜皇朝 +兴城神之队" + name.gsub("\n", ",").split(",") + end + name = user_team_name user_ids = User.where(is_test: true).pluck(:id) while(user_ids.length > 0) users = user_ids.pop(rand(3..5)) invite_code = generate_team_code - puts("#{invite_code}"); - new_team = CompetitionTeam.create!(:competition_id => 6, :name => "daiao#{users[0]}", + team_name = name.pop() + puts("#{invite_code}, #{team_name}"); + new_team = CompetitionTeam.create!(:competition_id => 6, :name => "#{team_name}", :invite_code => invite_code, :user_id => users[0]) users.each_with_index do |u, index| role = index == 0 ? 1 : 0