Commit 482a9691 by liyijie

feat: add record ta_statistic & ta_statistics attr_accessor support

parent 6cba9b85
......@@ -131,6 +131,8 @@ module TalltyImportExport
[association_record]
records.each do |record|
record.ta_statistics = record.ta_statistic(options[:resource_stat_condition]) if options[:resource_stat_condition].present?
row = []
formats = []
index += 1
......
......@@ -61,6 +61,8 @@ module TalltyImportExport
[association_record]
records.each do |record|
record.ta_statistics = record.ta_statistic(options[:resource_stat_condition]) if options[:resource_stat_condition].present?
value_living_alone_col_index_to_value_count = {}
payload = TalltyImportExport::ExportPayload.new(record, header: header_obj) do |payload, header, **opts|
......@@ -95,12 +97,12 @@ module TalltyImportExport
# 合并仅有一个值的一列中所有格子
value_living_alone_col_index_to_value_count.each_pair do |col_index, count|
if count == 1
next unless count == 1
sheet.merge_cells(
Axlsx::cell_r(col_index, index) + ':' + Axlsx::cell_r(col_index, index + payload.max_matrix_height - 1)
Axlsx.cell_r(col_index, index) + ':' + Axlsx.cell_r(col_index, index + payload.max_matrix_height - 1),
)
end
end
index += payload.max_matrix_height
end
......
......@@ -168,12 +168,12 @@ module TalltyImportExport
end.with_indifferent_access
end
def handle_attr_type val, header, line_info
def handle_attr_type(val, header, line_info)
case header[:attr_type].to_s
when 'file'
if val.is_a?(String)
val.split("\n").map do |url|
params = url.include?('?') ? CGI::parse(url.split('?').last) : {}
params = url.include?('?') ? CGI.parse(url.split('?').last) : {}
{
url: url,
fileName: params['fileName']&.first,
......
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