|
|
|
@@ -93,10 +93,15 @@ namespace :nico do |
|
|
|
sync_post_tags!(post, [Tag.tagme.id, Tag.bot.id, Tag.niconico.id, Tag.video.id]) |
|
|
|
end |
|
|
|
|
|
|
|
kept_ids = post.tags.pluck(:id).to_set |
|
|
|
kept_non_nico_ids = post.tags.not_nico.pluck(:id).to_set |
|
|
|
post_tags = post.tags |
|
|
|
# 既存のタグ Id. 集合 |
|
|
|
kept_ids = post_tags.pluck(:id).to_set |
|
|
|
# うち内部タグ Id. 集合 |
|
|
|
kept_non_nico_ids = post_tags.not_nico.pluck(:id).to_set |
|
|
|
|
|
|
|
# 記載すべき外部タグ Id. のリスト |
|
|
|
desired_nico_ids = [] |
|
|
|
# 記載すべき内部タグ Id. のリスト |
|
|
|
desired_non_nico_ids = [] |
|
|
|
|
|
|
|
datum['tags'].each do |raw| |
|
|
|
@@ -114,7 +119,7 @@ namespace :nico do |
|
|
|
if deerjikist |
|
|
|
desired_non_nico_ids << deerjikist.tag_id |
|
|
|
desired_nico_ids << deerjikist.tag_id |
|
|
|
elsif !(Tag.where(id: desired_all_ids).where(category: :deerjikist).exists?) |
|
|
|
elsif !(Tag.where(id: kept_non_nico_ids).where(category: :deerjikist).exists?) |
|
|
|
desired_non_nico_ids << Tag.no_deerjikist.id |
|
|
|
desired_nico_ids << Tag.no_deerjikist.id |
|
|
|
end |
|
|
|
|