Commit 1c20b6c1 by liyijie

feat: add find_each for association_records

parent 7468b5a6
......@@ -125,12 +125,16 @@ module TalltyImportExport
first_content_row_index = respond_to?(:first_header) ? 2 : 1
index = 0
association_records.each do |association_record|
# 如果 association_records 是 ActiveRecord::Relation 对象,使用 find_each 进行批量处理,否则使用 each
record_each_method = association_records.is_a?(ActiveRecord::Relation) ? :find_each : :each
association_records.send(record_each_method) do |association_record|
records = @each_method.present? ?
(try_method(association_record, @each_method) || [nil]) :
[association_record]
records.each do |record|
records.compact.each do |record|
next if record.nil?
record.ta_statistics = record.ta_statistic(options[:resource_stat_condition]) if options[:resource_stat_condition].present?
row = []
......@@ -158,6 +162,7 @@ module TalltyImportExport
last_row = row
end
end
# 需要根据column进行多行的内容合并
if merge_column_hash.present?
merge_column_hash.each do |col_index, row_arr|
......
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