Commit 61c88dd3 by liyijie

feat: 导入顺序,按照headers里面定义的顺序处理

parent 9816c47b
......@@ -105,13 +105,13 @@ module TalltyImportExport
end
def convert_data line_info
line_info.with_indifferent_access.reduce({}) do |h, (k, v)|
header = import_headers_result.find do |_header|
_header[:key].to_sym == k.to_sym
end
info = line_info.with_indifferent_access
import_headers_result.reduce({}) do |h, _header|
k = _header[:key]
v = info[k]
# header[:convert] = handle_xxx
# handle_xxx(val, processing_line_info, raw_line_info)
val = header[:convert] ? send(header[:convert], v, h, line_info) : v
val = header[:convert] ? send(header[:convert], v, h, info) : v
if header[:json]
h[header[:json]] ||= {}
h[header[:json]][k] = val
......
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