Fix docx report generation for step tables with unknown metadata [SCI-8353] (#5330)

This commit is contained in:
ajugo 2023-04-21 12:00:02 +02:00 committed by GitHub
parent 9e058af0a3
commit 8eb7d9fa9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,8 +7,8 @@ module Reports::Docx::DrawStepTable
obj = self obj = self
@docx.p @docx.p
@docx.table JSON.parse(table.contents_utf_8)['data'], border_size: Constants::REPORT_DOCX_TABLE_BORDER_SIZE do @docx.table JSON.parse(table.contents_utf_8)['data'], border_size: Constants::REPORT_DOCX_TABLE_BORDER_SIZE do
if table.metadata if table.metadata.present?
table.metadata['cells'].each do |cell| table.metadata['cells']&.each do |cell|
data = cell[1] data = cell[1]
next unless data.present? && data['row'].present? && data['col'].present? && data['className'].present? next unless data.present? && data['row'].present? && data['col'].present? && data['className'].present?