このコミットが含まれているのは:
@@ -107,11 +107,14 @@ class PostImportsController < ApplicationController
|
|||||||
raise ArgumentError, 'タグ由来が大きすぎます.'
|
raise ArgumentError, 'タグ由来が大きすぎます.'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
source_row = Integer(normalised['source_row'], exception: false)
|
||||||
|
raise ArgumentError, '元行番号が不正です.' if source_row.nil? || source_row <= 0
|
||||||
|
|
||||||
|
normalised['source_row'] = source_row
|
||||||
normalised.symbolize_keys
|
normalised.symbolize_keys
|
||||||
end
|
end
|
||||||
source_rows = normalised_rows.map { _1[:source_row] }
|
source_rows = normalised_rows.map { _1[:source_row] }
|
||||||
if source_rows.any? { |value| Integer(value, exception: false).to_i <= 0 } ||
|
if source_rows.uniq.length != source_rows.length
|
||||||
source_rows.uniq.length != source_rows.length
|
|
||||||
raise ArgumentError, '元行番号が不正です.'
|
raise ArgumentError, '元行番号が不正です.'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,10 @@ class PostImportPreviewer
|
|||||||
video_ms: parse_duration(attributes['duration'], errors))
|
video_ms: parse_duration(attributes['duration'], errors))
|
||||||
post.valid?
|
post.valid?
|
||||||
post.errors.each { |error| (errors[error.attribute] ||= []) << error.message }
|
post.errors.each { |error| (errors[error.attribute] ||= []) << error.message }
|
||||||
errors.delete(:url)
|
if errors[:url]
|
||||||
|
errors[:url].reject! { |message| message.include?('すでに存在') || message.include?('taken') }
|
||||||
|
errors.delete(:url) if errors[:url].empty?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_duration value, errors
|
def parse_duration value, errors
|
||||||
|
|||||||
@@ -90,6 +90,11 @@ class PostImportRunner
|
|||||||
raise ArgumentError, '取込行の形式が不正です.'
|
raise ArgumentError, '取込行の形式が不正です.'
|
||||||
end
|
end
|
||||||
|
|
||||||
row.to_h.deep_transform_keys { _1.to_s.underscore }
|
normalised = row.to_h.deep_transform_keys { _1.to_s.underscore }
|
||||||
|
source_row = Integer(normalised['source_row'], exception: false)
|
||||||
|
raise ArgumentError, '元行番号が不正です.' if source_row.nil? || source_row <= 0
|
||||||
|
|
||||||
|
normalised['source_row'] = source_row
|
||||||
|
normalised
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする