mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-06 04:34:06 +08:00
Merge pull request #6251 from okriuchykhin/ok_SCI_9327
Fix rendering of tables with broken metadata in docx reports [SCI-9327]
This commit is contained in:
commit
378c4c3cab
2 changed files with 8 additions and 8 deletions
|
@ -9,8 +9,8 @@ module Reports::Docx::DrawResultTable
|
|||
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|
|
||||
if table.metadata.present? && table.metadata['cells'].is_a?(Array)
|
||||
table.metadata['cells'].each do |cell|
|
||||
next unless cell['row'].present? && cell['col'].present?
|
||||
|
||||
row_index = cell['row'].to_i + 1
|
||||
|
@ -27,8 +27,8 @@ module Reports::Docx::DrawResultTable
|
|||
cell_style rows[0], bold: true, background: color[:concrete]
|
||||
cell_style cols[0], bold: true, background: color[:concrete]
|
||||
|
||||
if table.metadata.present?
|
||||
table.metadata['cells']&.each do |cell|
|
||||
if table.metadata.present? && table.metadata['cells'].is_a?(Array)
|
||||
table.metadata['cells'].each do |cell|
|
||||
next unless cell.present? && cell['row'].present? && cell['col'].present? && cell['className'].present?
|
||||
|
||||
cell_style rows.dig(cell['row'].to_i + 1, cell['col'].to_i + 1),
|
||||
|
|
|
@ -8,8 +8,8 @@ module Reports::Docx::DrawStepTable
|
|||
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|
|
||||
if table.metadata.present? && table.metadata['cells'].is_a?(Array)
|
||||
table.metadata['cells'].each do |cell|
|
||||
next unless cell['row'].present? && cell['col'].present?
|
||||
|
||||
row_index = cell['row'].to_i + 1
|
||||
|
@ -26,8 +26,8 @@ module Reports::Docx::DrawStepTable
|
|||
cell_style rows[0], bold: true, background: color[:concrete]
|
||||
cell_style cols[0], bold: true, background: color[:concrete]
|
||||
|
||||
if table.metadata.present?
|
||||
table.metadata['cells']&.each do |cell|
|
||||
if table.metadata.present? && table.metadata['cells'].is_a?(Array)
|
||||
table.metadata['cells'].each do |cell|
|
||||
data = cell[1]
|
||||
next unless data.present? && data['row'].present? && data['col'].present? && data['className'].present?
|
||||
|
||||
|
|
Loading…
Reference in a new issue