mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 19:51:01 +08:00
Fix docx table generator if metadata are nil [SCI-8165]
This commit is contained in:
parent
64441f791f
commit
8bf9e2425b
1 changed files with 5 additions and 3 deletions
|
@ -8,12 +8,14 @@ module Reports::Docx::DrawResultTable
|
|||
obj = self
|
||||
@docx.p
|
||||
@docx.table JSON.parse(table.contents_utf_8)['data'], border_size: Constants::REPORT_DOCX_TABLE_BORDER_SIZE do
|
||||
JSON.parse(table.metadata)['cells'].each do |cell|
|
||||
if table.metadata.present?
|
||||
JSON.parse(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, cell['col'].to_i), align: obj.table_cell_alignment(cell['className'])
|
||||
end
|
||||
end
|
||||
end
|
||||
@docx.p do
|
||||
text result.name, italic: true
|
||||
text " #{I18n.t('search.index.archived')} ", bold: true if result.archived?
|
||||
|
|
Loading…
Reference in a new issue