In issue #5490 the global settings option for an independent subtask priority/start date/due date/done ratio was implemented (closed in #5490-91). There were some fixes to this or related functionality in #21449, #20994 and #27533.
In note #5490-91 Jean-Philippe Lang mentioned a third "restricted children" option as to vaguely specified.
I would like to propose a specification for this third option allowing a hybrid approach, where it is still possible to set a separate start- and end-date for the parent ticket and calculate the overall date according to the following ruleset.
For the start date:
If the start date of the parent ticket is "older/lower" than the the oldest date of the subtickets, the parent tickets own start date is used (just like in the independent setting now).
If the start date of any of the subtickets is older than the parent ticket, then the oldest subticket date is used (just like in the dependent setting now).
For the end date:
If the end date of the parent ticket is "newer" than the the newest date of the subtickets, the parent tickets own end date is used (just like in the independent setting now).
If the end date of any of the subtickets is newer than the parent ticket then newest subticket date is used (just like in the dependent setting now).
As an example: Let have a parent-ticket with a start-date as 01. March 2021. Adding a subticket with a start-date of 10. March 2021, the parent-ticket keeps the start-date 01. March 2021. Adding another subticket with a start-date of 15. February 2021, the parent start-date gets updated to 15. February too. Now setting the parent-ticket start-date to 05. February is allowed. Setting the parent-ticket start-date to 05. March, raises an error stating a subticket restricts the start-date to 15. February. (The user could even be asked if he wants to update the subticket date(s) accordingly, but I would consider that optional at first.)
UI-wise I would suggest leaving the start and end Dates in the parent tickets visible and editable but check for the above conditions when submitting changes.
Adding this feature would allow to have parent tickets keep track of their scheduled dates while automatically moving them if subtask requires it. This would make working with project schedules e.g. Gantt-Chart more useful.
To not just ask for features to be added or changed, but rather provide some input myself, let me add the following suggestion for an implementation to discuss. Maybe someone with more advanced Redmine knowledge then myself could have a look whether this is feasible and would stand a chance to be added into the Redmine codebase. I might then be able to provide a patch.
as well as a definition of "dates_partially_derived" to
/app/models/issue.rb
def dates_partially_derived?
!leaf? && Setting.parent_issue_dates == 'partially_derived'
end
and a new calculation method (not tested yet, consider as pseudo code) for the partially derived case to
/app/models/issue.rb:
if p.dates_partially_derived?
# start/due dates = lowest/highest dates of children or own date
p.start_date = [p.children.minimum(:start_date), p.start_date].compact.min
p.due_date = [p.children.maximum(:due_date), p.due_date].compact.max
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
end
The same partial options could also be added to parent_issue_priority_options and parent_issue_done_ratio_options. This would result in the following overall behaviour when the partial options are selected.
Start-date can not be later than first child start date, but can be sooner
Due-date can not be sooner than last child end date, but can be later
Done ratio can not be higher than combined children's done ration, but can be lower
Priority can not be lower than maximum child priority, but can be higher
However, at first, I would only consider handling the dates, leaving done-ratio and priority for later.
Of course there is more to this, like localization e.g. in config/locales/en-GB.yml or config/locales/de.yml, I would suggest the following:
label_parent_task_attributes_derived: Calculated from subtasks
label_parent_task_attributes_partially_derived: Partially calculated from subtasks
label_parent_task_attributes_independent: Independent of subtasks
label_parent_task_attributes_derived: Abgeleitet von untergeordneten Tickets
label_parent_task_attributes_partially_derived: Teilweise abgeleitet von untergeordneten Tickets
label_parent_task_attributes_independent: Unabhängig von untergeordneten Tickets
Attached is a patch against git commit 8075884bc48deb3b7af94799d6eba943e999dcb2 which implements the functionality described above.
The patch basically consists of the changes outlined in #34609-1. In addition I had to add a bit of code to app/models/issue.rb validate_issue.
Also included are localizations for the locales en, en-GB and de.
I have no unit tests yet, because the tests don't run on my machine for some unrelated reason. Manual testing against an fresh installation based on 8075884bc48deb3b7af94799d6eba943e999dcb2 looks good so far.
I've added unit test for all new functionality as well as fixed a bug that showed itself during testing. The test are added to the file "test/unit/issue_subtasking_test.rb" which I ran using ruby test/unit/issue_substasking.rb as well as via the full test run using rake test.
rake locales:update transfers only the last new entry to all other locale files.
EDIT: According to its description locales:update is not able to update the first four entries, as they are not top-level. These would need to be added manually or locale:update would need to be expanded to handle added non-top-level keys.
On the other hand running these tests via ruby test/unit/lib/redmine/i18n_test.rb on the current origin/master, without my changes results in the same failure. So it might not be related to my changes at all.
Failure 3: "AttachmentControllerTest#test_thumbnail_for_pdf_should_be_png" and
Error 1: AttachmentTest#test_thumbnail_should_generate_the_thumbnail" from "test/unit/attachement_test.rb"
These two seem unrelated, something about a security policy.
Attached the patch (patch34609-3.diff) including all changes against the now current Git 7b9f5af and SVN R21268.
I would consider it ready for a review.
Somewhat off topic: As part of my effort to this patch I will provide up-to-date documentation on how to set up a Redmine development system on Debian 11, which might be a useful addition to the Developer_Guide or rather a subpage of it.