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.
Based on Github Commit 506fc9d74cdb67af2eaea27662420ec07e32b2f3 or Redmine SVN R21238 I have identified the following code to be related to how start-date and due-date in parent issues are handled:
/app/models/issue.rb:L1411
def dates_derived?
!leaf? && Setting.parent_issue_dates == 'derived'
end
which defines dates_derived, for all issues with child-issues, if the corresponding configuration option is set.
/app/models/issue.rb:L529
if dates_derived?
names -= %w(start_date due_date)
end
which removes start-date and due-date from the available/editable fields.
/app/models/issue.rb:L1823
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)
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
which controls how the field values are calculated if the config option is set to "derived".
app/helpers/settings_helper.rb:L185
def parent_issue_dates_options
options = [
[:label_parent_task_attributes_derived, 'derived'],
[:label_parent_task_attributes_independent, 'independent']
]
which defines the available configuration options for how dates are handled.
I would now suggest adding another option "partially derived" to
app/helpers/settings_helper.rb
def parent_issue_dates_options
options = [
[:label_parent_task_attributes_derived, 'derived'],
[:label_parent_task_attributes_partially_derived, 'partially_derived'],
[:label_parent_task_attributes_independent, 'independent']
]
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:
config/locales/en-GB.yml
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
config/locales/de.yml
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
Another topic are the test cases in /test/unit/issue_subtasking_test.rb
Currently the tests for date related functionality are:
- test_parent_dates_should_be_read_only_with_parent_issue_dates_set_to_derived
- test_parent_dates_should_be_lowest_start_and_highest_due_dates_with_parent_issue_dates_set_to_derived
- test_reschuling_a_parent_should_reschedule_subtasks_with_parent_issue_dates_set_to_derived
- test_parent_dates_should_be_editable_with_parent_issue_dates_set_to_independent
- test_parent_dates_should_not_be_updated_with_parent_issue_dates_set_to_independent
- test_reschuling_a_parent_should_not_reschedule_subtasks_with_parent_issue_dates_set_to_independent
I would definitely add:
- test_parent_dates_should_be_editable_with_parent_issue_dates_set_to_partially_derived
- test_parent_dates_should_be_lowest_start_and_highest_due_dates_with_parent_issue_dates_set_to_partially_derived
I am not yet sure about the rescheduling part, which possibly means my suggestion above might also be incomplete.
As stated above, suggestions and hints are welcome. In the meantime I will be working on getting this to run.