このコミットが含まれているのは:
2026-07-15 19:57:09 +09:00
コミット 6e5aa1e30f
16個のファイルの変更299行の追加345行の削除
+11 -2
ファイルの表示
@@ -46,6 +46,13 @@ class PostImportRunner
end
{ source_row: row['source_row'], status: 'failed', errors: e.record.errors.to_hash }
rescue ActiveRecord::RecordNotUnique
existing_post = existing_post_for_race(row)
raise unless existing_post
{ source_row: row['source_row'],
status: 'skipped',
existing_post_id: existing_post.id }
rescue Tag::NicoTagNormalisationError
{ source_row: row['source_row'],
status: 'failed',
@@ -66,8 +73,10 @@ class PostImportRunner
errors: { base: ['登録中にエラーが発生しました.'] } }
end
def existing_post_for_race row, record
return nil unless record.errors.of_kind?(:url, :taken)
def existing_post_for_race row, record = nil
if record && !(record.errors.of_kind?(:url, :taken))
return nil
end
normal_url = PostUrlNormaliser.normalise(row['url'])
return nil if normal_url.blank?