Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#63600] PDF timesheet: Error for TimeEntry with hours set to nil

as-op6f9056d5d4bb
diff --git a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb
index 57a603151a7..53ad0e2a1ad 100644
--- a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb
+++ b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb
@@ -172,7 +172,7 @@ class CostQuery::PDF::TimesheetGenerator
end
def sum_time_entries(entries)
- entries.sum(&:hours)
+ entries.map(&:hours).compact.sum
end
def build_table_row_comment(entry)
@@ -401,7 +401,7 @@ class CostQuery::PDF::TimesheetGenerator
rows.push([user.name, format_sum_time_entries(entries)])
end
- total = groups.sum { |_user, entries| entries.sum(&:hours) }
+ total = groups.sum { |_user, entries| sum_time_entries(entries) }
rows.push(["", { content: format_hours(total), font_style: :bold }])
rows
end