Commit 8c4adeec by liyijie

fix: 修复import_headers app: nil 空的问题

parent d54d8892
...@@ -137,14 +137,14 @@ module TalltyImportExport ...@@ -137,14 +137,14 @@ module TalltyImportExport
def import_headers_result def import_headers_result
if @headers.present? if @headers.present?
headers_hash = @headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access headers_hash = @headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access
import_headers.select do |_header| import_headers(**context.params.symbolize_keys).select do |_header|
_header.with_indifferent_access[:key].to_s.in?(headers_hash.keys) _header.with_indifferent_access[:key].to_s.in?(headers_hash.keys)
end.map do |_header| end.map do |_header|
_header = _header.with_indifferent_access _header = _header.with_indifferent_access
_header.merge(headers_hash[_header[:key]].delete_if { |k, v| v.blank? }) _header.merge(headers_hash[_header[:key]].delete_if { |k, v| v.blank? })
end end
else else
@headers = import_headers @headers = import_headers(**options.symbolize_keys)
end end
rescue rescue
@headers @headers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment