Skip to content

Commit

Permalink
feat: 🎸 Gss::Character を追加した (#79)
Browse files Browse the repository at this point in the history
* feat: 🎸 Gss::Character を追加した

* style: 💄 RuboCop の指摘に従い修正した

* fix: 🐛 Fix a spec
  • Loading branch information
nikukyugamer authored Jul 15, 2023
1 parent 8f18ff5 commit e7f52c3
Show file tree
Hide file tree
Showing 19 changed files with 289 additions and 252 deletions.
5 changes: 5 additions & 0 deletions app/models/gss.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Gss
def self.table_name_prefix
'gss_'
end
end
4 changes: 4 additions & 0 deletions app/models/gss/character.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Gss
class Character < ApplicationRecord
end
end
11 changes: 1 addition & 10 deletions app/service/import_service/character.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
module ImportService
class Character < Base
def rows
on_sheet_gss_characters = ::OnSheet::GssCharacter.all

# TODO: 「極」からのデータソースを作り、幻水総選挙は別名前空間へ移す
names = on_sheet_gss_characters.map(&:name)
# TODO: 名前のデータソースを作る
name_ens = on_sheet_gss_characters.count.times.map { |_| '' }

names.zip(name_ens)
end
def rows; end
end
end
24 changes: 24 additions & 0 deletions app/service/import_service/gss/character.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module ImportService
module Gss
class Character
def execute
on_sheet_gss_characters = ::OnSheet::GssCharacter.all
names = on_sheet_gss_characters.map(&:name)
sosenkyo_names = on_sheet_gss_characters.map(&:sosenkyo_name)

gss_characters = []

names.zip(sosenkyo_names).each do |name, sosenkyo_name|
next if sosenkyo_name.blank?

gss_characters << ::Gss::Character.new(
name:,
sosenkyo_name:
)
end

::Gss::Character.import!(gss_characters)
end
end
end
end
4 changes: 2 additions & 2 deletions db/csv_on_sheet/characters/bases.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id,star_attr,s1,s1_yomi,s1_en,s2,s2_yomi,s2_en,s3,s3_yomi,s3_en,s4,s4_yomi,s4_en,s5,s5_yomi,s5_en,tk,tk_yomi,tk_en,woven,woven_yomi,woven_en,water_margin,water_margin_yomi,water_margin_en
1,天魁星,I主人公,わんしゅじんこう,Hero,II主人公,"",Herp,トーマス,"",Thomas,IV主人公,"",Hero,王子,"",Hero,主人公,"",Hero,主人公,"","",宋江
1,天魁星,I主人公,わんしゅじんこう,Hero,II主人公,"",Herp,トーマス,"",Thomas,IV主人公,"",Hero,王子,"",Hero,主人公,"",Hero,主人公,"","",宋江,そうこう
2,天罡星,レパント,れぱんと,Lepant,リドリー・ワイゼン / ボリス・ワイゼン,"",Ridley/Boris,ササライ,"",Sasarai,リノ・エン・クルデス,"",Lino En Kuldes,ラージャ,"",Raja,ダイアルフ,"",Diulf,ジャグワン,"","",盧俊義
3,天機星,マッシュ・シルバーバーグ,"",Mathiu,シュウ,"",Shu,シーザー・シルバーバーグ,"",Caesar Silverberg,エレノア・シルバーバーグ,"",Elenor,ルクレティア・メルセス,"",Lucretia Merces,リウ,"",Liu,レギウス,"","",呉用
3,天機星,マッシュ・シルバーバーグ,まっしゅしるばーばーぐ,Mathiu,シュウ,"",Shu,シーザー・シルバーバーグ,"",Caesar Silverberg,エレノア・シルバーバーグ,"",Elenor,ルクレティア・メルセス,"",Lucretia Merces,リウ,"",Liu,レギウス,"","",呉用
4,天間星,ルック,"",Luc,ルック,"",Luc,ルック,"",Luc,テッド,"",Ted,ゼラセ,"",Zerase,ゼノア,"",Zenoa,ゼフォン,"","",公孫勝
5,天勇星,ハンフリー・ミンツ,"",Humphrey,ハンフリー・ミンツ,"",Humphrey,デュパ,"",Dupa,タル,"",Tal,クレイグ・ラーデン,"",Craig Laden,オルドヴィーク,"",Ordovic,ゴンボスレン,"","",関勝
6,天雄星,カシム・ハジル,"",Kasim,ハウザー,"",Hauser,ユーバー,"",Yuber,イザク,"",Izak,ガレオン,"",Galleon,メギオン,"",Megion,ザヴィド,"","",林冲
Expand Down
10 changes: 5 additions & 5 deletions db/csv_on_sheet/gss_character/web_format_data.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id,gensosenkyo_name,name,has_nickname,exists_gs1,exists_gs2,exists_gs3,exists_gs4,exists_gs5,exists_in_each_gaiden,exists_gaiden1,exists_gaiden2,exists_rhapsodia,exists_tk,exists_tsumutoki,memo
id,sosenkyo_name,name,has_nickname,exists_gs1,exists_gs2,exists_gs3,exists_gs4,exists_gs5,exists_in_each_gaiden,exists_gaiden1,exists_gaiden2,exists_rhapsodia,exists_tk,exists_tsumutoki,memo
1,幻水1主人公(坊ちゃん),1主人公,FALSE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE
2,幻水2主人公(2主),2主人公,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE,FALSE,FALSE
3,幻水4主人公(4様),4主人公,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE
Expand Down Expand Up @@ -67,7 +67,7 @@ id,gensosenkyo_name,name,has_nickname,exists_gs1,exists_gs2,exists_gs3,exists_gs
66,"",ヴィルヘルム,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
67,"",ヴィンセント・フィンガーフート,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
68,"",ウィンディ,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
69,"",ウィンドゥ,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
69,"",ウインドウ,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
70,"",ウェンデル,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
71,"",ウォーグ,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE
72,"",ウォーレン,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
Expand Down Expand Up @@ -862,9 +862,9 @@ id,gensosenkyo_name,name,has_nickname,exists_gs1,exists_gs2,exists_gs3,exists_gs
860,ペック(暗器使い),暗器使い,TRUE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,本名:ペック(ラプソ出典)
861,"",一なる王,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE
862,"",炎の英雄,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
863,"",館の執事,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE
864,"",軍医,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE
863,"",館の執事,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,フォームからは外す
864,"",軍医,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,フォームからは外す
865,"",総督,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
866,紡がれし百年の時主人公(紡主),紡時主人公,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE
867,"",霧の船の導者,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE
868,"",料理長,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE
868,"",料理長,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,フォームからは外す
2 changes: 1 addition & 1 deletion db/csv_on_sheet/gss_cities_section/web_format_data.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id,product_name,country_name,city_name,is_available,is_town_or_village_or_city,is_dungeon,is_architecture,is_others,memo
id,product_name,country_name,city_name,is_available,is_town_or_village_or_city,is_dungeon,is_architecture,is_others,memo,city_yomi,display_order
1,幻水I,赤月帝国,アールス地方,FALSE,FALSE,FALSE,FALSE,TRUE
2,幻水I,赤月帝国,アールスの地,FALSE,FALSE,FALSE,FALSE,TRUE
3,幻水I,赤月帝国,赤月帝国,FALSE,FALSE,FALSE,FALSE,TRUE
Expand Down
Loading

0 comments on commit e7f52c3

Please sign in to comment.