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
load work package for journaling in batches
ulfertsa2a0a8fb272b
diff --git a/app/workers/work_packages/apply_working_days_change_job.rb b/app/workers/work_packages/apply_working_days_change_job.rbindex b6699b34ab3..4a087e60603 100644--- a/app/workers/work_packages/apply_working_days_change_job.rb+++ b/app/workers/work_packages/apply_working_days_change_job.rb@@ -75,8 +75,7 @@ class WorkPackages::ApplyWorkingDaysChangeJob < ApplicationJobfor_each_work_package_in_scope(WorkPackage.covering_days_of_week(changed_days).order(WorkPackage.arel_table[:start_date].asc.nulls_first,- WorkPackage.arel_table[:due_date].asc)- .pluck(:id),+ WorkPackage.arel_table[:due_date].asc),&)end@@ -92,8 +91,7 @@ class WorkPackages::ApplyWorkingDaysChangeJob < ApplicationJobdef each_applicable_predecessor(excluded, &)for_each_work_package_in_scope(WorkPackage.where(id: Relation.follows_with_delay.select(:to_id))- .where.not(id: excluded)- .pluck(:id),+ .where.not(id: excluded),&)end@@ -101,7 +99,10 @@ class WorkPackages::ApplyWorkingDaysChangeJob < ApplicationJobday_changes = changed_days(previous_working_days).index_with { |day| Setting.working_days.include?(day) }journal_note = journal_notice_text(day_changes)- for_each_work_package_in_scope(updated_work_package_ids.uniq) do |work_package|+ WorkPackage+ .where(id: updated_work_package_ids.uniq)+ .in_batches+ .each_record do |work_package|work_package.journal_notes = journal_notework_package.saveend@@ -120,7 +121,7 @@ class WorkPackages::ApplyWorkingDaysChangeJob < ApplicationJobenddef for_each_work_package_in_scope(scope)- scope.each do |id|+ scope.pluck(:id).each do |id|yield WorkPackage.find(id)endend