mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-28 11:14:24 +08:00
Update the native table calculations display in reports [SCI-8739]
This commit is contained in:
parent
db8583c39c
commit
fac8945870
2 changed files with 28 additions and 0 deletions
|
@ -8,6 +8,20 @@ module Reports::Docx::DrawResultTable
|
|||
obj = self
|
||||
table_data = JSON.parse(table.contents_utf_8)['data']
|
||||
table_data = obj.add_headers_to_table(table_data, false)
|
||||
|
||||
if table.metadata.present?
|
||||
table.metadata['cells']&.each do |cell|
|
||||
next unless cell['row'].present? && cell['col'].present?
|
||||
|
||||
row_index = cell['row'].to_i + 1
|
||||
col_index = cell['col'].to_i + 1
|
||||
calculated_value = cell['calculated']
|
||||
|
||||
if calculated_value.present?
|
||||
table_data[row_index][col_index] = calculated_value
|
||||
end
|
||||
end
|
||||
end
|
||||
@docx.p
|
||||
@docx.table table_data, border_size: Constants::REPORT_DOCX_TABLE_BORDER_SIZE do
|
||||
cell_style rows[0], bold: true, background: color[:concrete]
|
||||
|
|
|
@ -7,6 +7,20 @@ module Reports::Docx::DrawStepTable
|
|||
obj = self
|
||||
table_data = JSON.parse(table.contents_utf_8)['data']
|
||||
table_data = obj.add_headers_to_table(table_data, table_type == 'step_well_plates_table')
|
||||
|
||||
if table.metadata.present?
|
||||
table.metadata['cells']&.each do |cell|
|
||||
next unless cell['row'].present? && cell['col'].present?
|
||||
|
||||
row_index = cell['row'].to_i + 1
|
||||
col_index = cell['col'].to_i + 1
|
||||
calculated_value = cell['calculated']
|
||||
|
||||
if calculated_value.present?
|
||||
table_data[row_index][col_index] = calculated_value
|
||||
end
|
||||
end
|
||||
end
|
||||
@docx.p
|
||||
@docx.table table_data, border_size: Constants::REPORT_DOCX_TABLE_BORDER_SIZE do
|
||||
cell_style rows[0], bold: true, background: color[:concrete]
|
||||
|
|
Loading…
Reference in a new issue