The change made in r24223 must be reverted. Because of this change, the done ratio of parent issues may be calculated incorrectly.
The purpose of this patch was to skip save in the recalculate_attributes_for method when the recalculated values of a parent issue (priority, start date, due date, and done ratio) are the same as the values already stored, and thereby avoid triggering recalculation for higher-level parent issues.
However, in recalculate_attributes_for, the done ratio calculation also depends on estimated hours. Even if the done ratio of an issue itself does not change, a change in estimated hours can still affect the done ratio of higher-level parent issues. Therefore, recalculation must not be skipped.
For example, assume there is an issue named "Root", with two child issues: "Parent" and "Leaf_1". Under "Parent", there are two more issues: "Leaf_2" and "Leaf_3".
Root --+-- Parent --+-- Leaf_2
| +-- Leaf_3
+-- Leaf_1
Assume the following values:
- Leaf_1: estimated hours = 10, done ratio = 0%
- Leaf_2: estimated hours = 10, done ratio = 50%
- Leaf_3: estimated hours = 10, done ratio = 50%
In this case, the done ratio is:
- Parent: 50%
(10 * 0.5 + 10 * 0.5) / 20 = 0.5
- Root: 33%
(0 * 0.5 + 10 * 0.5 + 10 * 0.5) / 30 = 0.33...
Next, suppose the estimated hours of Leaf_3 are changed from 10 hours to 40 hours. The done ratio of Parent remains 50%, but the done ratio of Root increases to 41% when recalculated with the increased estimated hours.
- Parent: 50%
(10 * 0.5 + 40 * 0.5) / 50 = 0.5
- Root: 41%
(0 * 0.5 + 10 * 0.5 + 40 * 0.5) / 60 = 0.416...
However, with the change r24223 is applied, recalculation is performed for Parent after modifying Leaf_3, but because the recalculated done ratio of Parent does not change, save is skipped. As a result, the after_save callback is not triggered, recalculation for Root is not performed, and the done ratio of Root incorrectly remains at 33%.
For this reason, r24223 must be reverted.