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

[#43120] Eager load work package associations to eliminate N+1 queries

Dombi Attila3b2492d137cb
diff --git a/lib/api/v3/work_packages/work_package_eager_loading_wrapper.rb b/lib/api/v3/work_packages/work_package_eager_loading_wrapper.rb
index 376474ccaa1..58d2705c3fa 100644
--- a/lib/api/v3/work_packages/work_package_eager_loading_wrapper.rb
+++ b/lib/api/v3/work_packages/work_package_eager_loading_wrapper.rb
@@ -92,6 +92,9 @@ module API
.joins(labor_scope.arel.join_sources)
.includes(WorkPackageRepresenter.to_eager_load)
.includes(:status)
+ .includes(:project)
+ .includes(:children)
+ .includes(:custom_values)
.select('work_packages.*')
.select('spent_time_hours.hours')
.select('derived_dates.derived_start_date', 'derived_dates.derived_due_date')