Defect #5880
Only consider open subtasks when computing the priority of a parent issue
Status: | Closed | Start date: | 2010-07-14 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Issues | |||
Target version: | 3.3.0 | |||
Resolution: | Fixed | Affected version: |
Description
When computing the priority of a task, only subtasks with not closed status should be considered.
Related issues
Associated revisions
Only consider open subtasks when computing the priority of a parent issue (#5880).
Patch by Go MAEDA.
History
#1
Updated by dimitar korudjiiski almost 12 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.
#2
Updated by Norbert Bérci almost 12 years ago
set back because previous modifier was using this instead of demo.redmine.org
#3
Updated by Norbert Bérci almost 12 years ago
- % Done changed from 60 to 0
#4
Updated by Ewan Makepeace over 11 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!)
#5
Updated by Andreas Bosch over 11 years ago
+1 - related to #5490 and #6847
Also see my forum post regarding this issue.
#6
Updated by Mischa The Evil over 10 years ago
- Subject changed from parent task priority computation to Only consider open subtasks when computing the priority of a parent issue
#7
Updated by Mischa The Evil over 10 years ago
- Category set to Issues
#8
Updated by Ross Saad over 9 years ago
+1
#9
Updated by John Pisani over 9 years ago
+1
#10
Updated by Emmanuel Serau about 9 years ago
+1
#11
Updated by Mikołaj Milej over 8 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 ;]
#12
Updated by A B almost 8 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
#13
Updated by txemi M over 7 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.
#14
Updated by Go MAEDA over 6 years ago
- Duplicated by Feature #19921: Issue priority with subtasks : not with closed issues added
#15
Updated by Go MAEDA over 6 years ago
- Target version set to Candidate for next major release
#16
Updated by Go MAEDA over 6 years ago
- Duplicated by Feature #15289: Recalculate priority of a parent issue automatically after child issue is closed added
#17
Updated by Go MAEDA over 6 years ago
- Duplicated by Defect #14933: Parent issues default to highest priority child issue, should be highest priority *OPEN* child issue added
#18
Updated by Go MAEDA over 6 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
#19
Updated by Go MAEDA over 6 years ago
- File 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.
#20
Updated by Jean-Philippe Lang over 6 years ago
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
- Resolution set to Fixed
Patch committed, thanks.