Commit d0767b39 by liyijie

feat: fix import_headers_result

parent 93d3cdb8
...@@ -113,13 +113,17 @@ module TalltyImportExport ...@@ -113,13 +113,17 @@ module TalltyImportExport
# TODO: 这里,对于import_headers,后面还是不要传参数了 # TODO: 这里,对于import_headers,后面还是不要传参数了
# 需要合并proc,前端没有办法把proc传过来 # 需要合并proc,前端没有办法把proc传过来
def import_headers_result def import_headers_result
import_header_hash = import_headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access if @headers.present?
@headers.map do |header| import_header_hash = import_headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access
key = header[:key] @headers.map do |header|
if import_header_hash.dig(key, :proc).present? key = header[:key]
header[:proc] = import_header_hash.dig(key, :proc) if import_header_hash.dig(key, :proc).present?
header[:proc] = import_header_hash.dig(key, :proc)
end
header
end end
header else
@headers = import_headers
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