Commit 9059d20b by Tấn Trần Thanh

cover some case nil

parent db3cc886
Pipeline #1603 failed with stages
in 0 seconds
......@@ -27,7 +27,7 @@ module WorkflowReport
result[0] << root_id
result[1] << issues.first.project.name.gsub(/[^[:print:]]/, '')
result[2] << root_issue&.subject.gsub(/[^[:print:]]/, '')
result[3] << issues.first.workflow_report_version.name
result[3] << issues.first.workflow_report_version&.name
issue_created_on = issues.min_by { |i| i[:created_on] if i[:created_on].present? }
result[4].push(issue_created_on.present? ? issue_created_on.created_on&.strftime('%Y-%m-%d %H:%M:%S') : '')
closed_on_issues = issues.map(&:closed_on).compact
......@@ -36,13 +36,13 @@ module WorkflowReport
issue_due_dates = issues.map(&:due_date).compact
issue_due_date = issue_due_dates.max_by { |due_date| due_date }
result[6].push(issue_due_date.present? ? issue_due_date&.strftime('%Y-%m-%d %H:%M:%S') : '')
result[7].push(root_issue.status.name.present? ? root_issue.status.name : '')
result[7].push(root_issue.status&.name.present? ? root_issue.status&.name : '')
sum_estimated_hours = issues.map(&:estimated_hours).compact.sum
result[8] << sum_estimated_hours
result[8] << sum_estimated_hours.round(2)
actual_time = issues.map { |issue| issue.time_entries.sum(:hours) }.sum
if actual_time.present?
result[9] << actual_time
result[10] << (actual_time - sum_estimated_hours)
result[9] << actual_time.round(2)
result[10] << (actual_time - sum_estimated_hours).round(2)
else
result[9] << ''
result[10] << ''
......@@ -62,8 +62,8 @@ module WorkflowReport
jp_request = ''
issues.each do |issue|
if issue.tracker_id == 12
pull_request = issue.custom_values.find_by(custom_field_id: PR_FIELD_ID).value
jp_request = issue.custom_values.find_by(custom_field_id: JP_REQUEST_FIELD_ID).value
pull_request = issue.custom_values.find_by(custom_field_id: PR_FIELD_ID)&.value
jp_request = issue.custom_values.find_by(custom_field_id: JP_REQUEST_FIELD_ID)&.value
end
process = get_process(issue.subject.gsub(/[^[:print:]]/, ''))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment