Skip to content

Commit

Permalink
feat: 🎸 chara_11 chara_12 のカラムを追加して実データの設計に合わせてインポートする (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikukyugamer committed Jul 11, 2022
1 parent acb3757 commit d62d4d8
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 13 deletions.
1 change: 1 addition & 0 deletions app/models/counting_bonus_vote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def self.ranking_sosenkyo_campaigns
chara_columns = %i[
chara_01 chara_02 chara_03 chara_04 chara_05
chara_06 chara_07 chara_08 chara_09 chara_10
chara_11 chara_12
]
ranking_records = []

Expand Down
12 changes: 8 additions & 4 deletions app/services/sheets/counting/bonus_votes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def self.import_via_tweet
bonus_category_to_sheet_id.each do |bonus_category, this_sheet_id|
next if this_sheet_id.blank?

rows = SheetData.get_rows(sheet_id: this_sheet_id, range: "#{sheet_names[i]}!A2:Q101")
rows = SheetData.get_rows(sheet_id: this_sheet_id, range: "#{sheet_names[i]}!A2:Z101")

rows.each do |row|
column_vs_value = column_vs_value(row)
Expand Down Expand Up @@ -41,7 +41,9 @@ def self.import_via_tweet
chara_07: column_vs_value[:input_07],
chara_08: column_vs_value[:input_08],
chara_09: column_vs_value[:input_09],
chara_10: column_vs_value[:input_10]
chara_10: column_vs_value[:input_10],
chara_11: column_vs_value[:input_11],
chara_12: column_vs_value[:input_12]
}

CountingBonusVote.find_or_initialize_by(unique_attrs).update!(mutable_attrs)
Expand All @@ -56,7 +58,7 @@ def self.import_via_tweet
def self.import_via_dm
ActiveRecord::Base.transaction do
sheet_names.each_with_index do |sheet_name, i|
rows = SheetData.get_rows(sheet_id: ENV.fetch('COUNTING_DIRECT_MESSAGES_SHEET_ID', nil), range: "#{sheet_names[i]}!A2:Q101")
rows = SheetData.get_rows(sheet_id: ENV.fetch('COUNTING_DIRECT_MESSAGES_SHEET_ID', nil), range: "#{sheet_names[i]}!A2:Z101")

rows.each do |row|
dm_column_vs_value = dm_column_vs_value(row)
Expand Down Expand Up @@ -185,7 +187,9 @@ def self.column_vs_value(row)
input_07: row[20],
input_08: row[21],
input_09: row[22],
input_10: row[23]
input_10: row[23],
input_11: row[24],
input_12: row[25]
}
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddCharaColumnsToCountingBonusVote < ActiveRecord::Migration[7.0]
def change
add_column :counting_bonus_votes, :chara_11, :string
add_column :counting_bonus_votes, :chara_12, :string
end
end
4 changes: 3 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions import_all_counting_data_to_local_db.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/bin/bash -xe

# bin/rails runner "CountingAllCharacter.destroy_all"
#bin/rails import_counting_all_characters:exec_all
bin/rails runner "CountingAllCharacter.destroy_all"
bin/rails import_counting_all_characters:exec_all

bin/rails runner "CountingUniteAttack.destroy_all"
bin/rails import_counting_unite_attacks:exec_all
# bin/rails runner "CountingUniteAttack.destroy_all"
# bin/rails import_counting_unite_attacks:exec_all

# bin/rails runner "CountingBonusVote.destroy_all"
# bin/rails import_counting_bonus_votes:exec_all
bin/rails runner "CountingBonusVote.destroy_all"
bin/rails import_counting_bonus_votes:exec_all

# 開票イラストデータは独立しているのでここでインポートする
bin/rails runner "Sheets::ResultIllustrationApplications.import_totallings_data_to_database"

exit 0
20 changes: 18 additions & 2 deletions write_all_final_result_to_sheets.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
#!/bin/bash -xe

# 単体・①オールキャラ部門
bin/rails runner "Sheets::WriteAndUpdate::FinalResults::AllCharactersStandAlone.new.exec"
bin/rails runner "Sheets::WriteAndUpdate::FinalResults::UniteAttacks.new.exec"
# TODO: ボーナス票
# bin/rails runner "Sheets::WriteAndUpdate::FinalResults::UniteAttacks.new.exec"

# ボ・お題小説
bin/rails runner "Sheets::WriteAndUpdate::FinalResults::BonusVotes::ShortStories.new.exec"

# ボ・開票イラスト
bin/rails runner "Sheets::WriteAndUpdate::FinalResults::BonusVotes::ResultIllustrations.new.exec"

# ボ・推し台詞
bin/rails runner "Sheets::WriteAndUpdate::FinalResults::BonusVotes::FavQuotes.new.exec"

# ボ・選挙運動
bin/rails runner "Sheets::WriteAndUpdate::FinalResults::BonusVotes::SosenkyoCampaigns.new.exec"

# ボ・OP・CLイラスト(オールキャラ)

# 最終・①オールキャラ部門

exit 0

0 comments on commit d62d4d8

Please sign in to comment.