From 72c158d3e2cdb34ec6434c3a6247103f0f590449 Mon Sep 17 00:00:00 2001 From: Miha Mencin Date: Mon, 25 Nov 2019 11:55:02 +0100 Subject: [PATCH] SCI-4108 check if there are any checklist items before rendering the checklist --- app/services/reports/docx/draw_step_checklist.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/services/reports/docx/draw_step_checklist.rb b/app/services/reports/docx/draw_step_checklist.rb index 5ec25d3dd..046049f2c 100644 --- a/app/services/reports/docx/draw_step_checklist.rb +++ b/app/services/reports/docx/draw_step_checklist.rb @@ -21,11 +21,13 @@ module Reports::Docx::DrawStepChecklist text I18n.t('projects.reports.elements.step_checklist.user_time', timestamp: I18n.l(timestamp, format: :full)), color: color[:gray] end - @docx.ul do - items.each do |item| - li do - text SmartAnnotations::TagToText.new(user, team, item.text).text - text " (#{I18n.t('projects.reports.elements.step_checklist.checked')})", color: '2dbe61' if item.checked + if items.any? + @docx.ul do + items.each do |item| + li do + text SmartAnnotations::TagToText.new(user, team, item.text).text + text " (#{I18n.t('projects.reports.elements.step_checklist.checked')})", color: '2dbe61' if item.checked + end end end end