Fix docx report generation with broken metadate [SCI-8165]

This commit is contained in:
Andrej 2023-03-20 11:14:27 +01:00
parent 7584242745
commit c84adfdecc
2 changed files with 6 additions and 2 deletions

View file

@ -9,9 +9,11 @@ module Reports::Docx::DrawResultTable
@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 rows[cell['row'].to_i].present?
cell_style rows[cell['row']][cell['col']], 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?

View file

@ -10,10 +10,12 @@ module Reports::Docx::DrawStepTable
if table.metadata
table.metadata['cells'].each do |cell|
data = cell[1]
if rows[data['row'].to_i].present?
cell_style rows[data['row'].to_i][data['col'].to_i], align: obj.table_cell_alignment(data['className'])
end
end
end
end
@docx.p do
text I18n.t('projects.reports.elements.step_table.table_name', name: table.name), italic: true
text ' '