Defect #5880
closedOnly consider open subtasks when computing the priority of a parent issue
Added by Norbert Bérci over 14 years ago. Updated almost 9 years ago.
0%
Description
When computing the priority of a task, only subtasks with not closed status should be considered.
Files
defect-5880.diff (2.32 KB) defect-5880.diff | patch against 3.2.0.devel.15058 | Go MAEDA, 2016-01-14 14:36 |
Related issues
Updated by dimitar korudjiiski over 14 years ago
- % Done changed from 0 to 60
Norbert Bérci wrote:
When computing the priority of a task, only subtasks with not closed status should be considered.
Updated by Norbert Bérci over 14 years ago
set back because previous modifier was using this instead of demo.redmine.org
Updated by Ewan Makepeace about 14 years ago
- Agreed.
- Also there is no way to tell which of many subtasks is driving the priority.
- For example my top priority level is emergency - but when it is a group I cant tell which is the emergency subtask (which might actually be closed!)
Updated by Andreas Bosch about 14 years ago
+1 - related to #5490 and #6847
Also see my forum post regarding this issue.
Updated by Mischa The Evil almost 13 years ago
- Subject changed from parent task priority computation to Only consider open subtasks when computing the priority of a parent issue
Updated by Mikołaj Milej about 11 years ago
+10
but, show me the code, I'll create a patch for it (or I'll find the code).
edit:
works for me:
in file: app/models/issue.rb
changed
# priority = highest priority of children
if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", :joins => :priority)
p.priority = IssuePriority.find_by_position(priority_position)
end
to
# priority = highest priority of children
if p.children.count > 0
if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", {:joins => [:priority, :status], :conditions => 'is_closed = 0'})
else
priority_position = IssuePriority.where("#{IssuePriority.table_name}.position", :conditions => 'is_default = 1')
end
p.priority = IssuePriority.find_by_position(priority_position)
end
I know almost nothing about Ruby and RoR so there is place for improvements and bug fixes ;]
Updated by A B about 10 years ago
The above patch does not work on db's with proper boolean types such as PostgreSQL; it also has a bug in the else clause in that it returns an IssuePriority object rather than a number. Here's an updated version that should work on all db's and fixes the bug:
# priority = highest priority of open children
if p.children.count > 0
if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", {:joins => [:priority, :status], :conditions => ['is_closed = ?', false]})
else
priority_position = IssuePriority.where(is_default: true).pluck(:position).first
end
p.priority = IssuePriority.find_by_position(priority_position)
end
Updated by txemi M almost 10 years ago
+1
I would like to see this implemented.
It is difficult for me get useful task views based on priority with all those already not important parent tasks showing on top.
Updated by Go MAEDA almost 9 years ago
- Has duplicate Feature #19921: Issue priority with subtasks : not with closed issues added
Updated by Go MAEDA almost 9 years ago
- Target version set to Candidate for next major release
Updated by Go MAEDA almost 9 years ago
- Has duplicate Feature #15289: Recalculate priority of a parent issue automatically after child issue is closed added
Updated by Go MAEDA almost 9 years ago
- Has duplicate Defect #14933: Parent issues default to highest priority child issue, should be highest priority *OPEN* child issue added
Updated by Go MAEDA almost 9 years ago
This is a patch for current trunk (r15058).
Index: app/models/issue.rb
===================================================================
--- app/models/issue.rb (revision 15058)
+++ app/models/issue.rb (working copy)
@@ -1451,9 +1451,11 @@
def recalculate_attributes_for(issue_id)
if issue_id && p = Issue.find_by_id(issue_id)
if p.priority_derived?
- # priority = highest priority of children
- if priority_position = p.children.joins(:priority).maximum("#{IssuePriority.table_name}.position")
+ # priority = highest priority of open children
+ if priority_position = p.children.open.joins(:priority).maximum("#{IssuePriority.table_name}.position")
p.priority = IssuePriority.find_by_position(priority_position)
+ else
+ p.priority = IssuePriority.default
end
end
Updated by Go MAEDA almost 9 years ago
- File defect-5880.diff defect-5880.diff added
- Target version changed from Candidate for next major release to 3.3.0
Here is a patch with tests: defect-5880.diff
Please consider merging this fix.
Updated by Jean-Philippe Lang almost 9 years ago
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
- Resolution set to Fixed
Patch committed, thanks.