1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-01 03:57:15 +00:00

Optimize Issue#recalculate_attributes_for by merging date queries (#43619).

Patch by Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@24229 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2025-12-24 06:27:52 +00:00
parent a62c38037a
commit 947fe1fff2

View File

@ -1870,8 +1870,7 @@ class Issue < ApplicationRecord
if p.dates_derived?
# start/due dates = lowest/highest dates of children
p.start_date = p.children.minimum(:start_date)
p.due_date = p.children.maximum(:due_date)
p.start_date, p.due_date = p.children.pick('MIN(start_date)', 'MAX(due_date)')
if p.start_date && p.due_date && p.due_date < p.start_date
p.start_date, p.due_date = p.due_date, p.start_date
end