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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
refactor: fetch all children dates at once
Christophe Bliardb9bc90e9c704
diff --git a/app/services/work_packages/set_attributes_service.rb b/app/services/work_packages/set_attributes_service.rbindex 34ce7b993b0..41cb8bad17a 100644--- a/app/services/work_packages/set_attributes_service.rb+++ b/app/services/work_packages/set_attributes_service.rb@@ -347,7 +347,7 @@ class WorkPackages::SetAttributesService < ::BaseServices::SetAttributesenddef min_child_date- (work_package.children.map(&:start_date) + work_package.children.map(&:due_date)).compact.min+ children_dates.minenddef children_duration@@ -362,7 +362,11 @@ class WorkPackages::SetAttributesService < ::BaseServices::SetAttributesenddef max_child_date- (work_package.children.map(&:start_date) + work_package.children.map(&:due_date)).compact.max+ children_dates.max+ end++ def children_dates+ @children_dates ||= work_package.children.pluck(:start_date, :due_date).flatten.compactenddef parent_start_earlier_than_due?