Project

General

Profile

Actions

Defect #5880

closed

Only 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.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
Start date:
2010-07-14
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

When computing the priority of a task, only subtasks with not closed status should be considered.

see http://demo.redmine.org/issues/26174


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

Related to Redmine - Feature #5490: Option for independent subtask priority/start date/due date/done ratioClosedJean-Philippe Lang2010-05-10

Actions
Related to Redmine - Defect #6847: Parent priorities not dropping when subtask priorities decreased.Closed2010-11-08

Actions
Has duplicate Redmine - Feature #13736: Parent priority does not update when subtasks are closedClosed

Actions
Has duplicate Redmine - Feature #19921: Issue priority with subtasks : not with closed issuesClosed

Actions
Has duplicate Redmine - Feature #15289: Recalculate priority of a parent issue automatically after child issue is closedClosed

Actions
Has duplicate Redmine - Defect #14933: Parent issues default to highest priority child issue, should be highest priority *OPEN* child issueClosed

Actions
Actions #1

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.

see http://demo.redmine.org/issues/26174

Actions #2

Updated by Norbert Bérci over 14 years ago

set back because previous modifier was using this instead of demo.redmine.org

Actions #3

Updated by Norbert Bérci over 14 years ago

  • % Done changed from 60 to 0
Actions #4

Updated by Ewan Makepeace about 14 years ago

  1. Agreed.
  2. Also there is no way to tell which of many subtasks is driving the priority.
  3. 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!)
Actions #5

Updated by Andreas Bosch about 14 years ago

+1 - related to #5490 and #6847

Also see my forum post regarding this issue.

Actions #6

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
Actions #7

Updated by Mischa The Evil almost 13 years ago

  • Category set to Issues
Actions #8

Updated by Ross Saad almost 12 years ago

+1

Actions #9

Updated by John Pisani almost 12 years ago

+1

Actions #10

Updated by Emmanuel Serau over 11 years ago

+1

Actions #11

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 ;]

Actions #12

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

Actions #13

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.

Actions #14

Updated by Go MAEDA almost 9 years ago

  • Has duplicate Feature #19921: Issue priority with subtasks : not with closed issues added
Actions #15

Updated by Go MAEDA almost 9 years ago

  • Target version set to Candidate for next major release
Actions #16

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
Actions #17

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
Actions #18

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

Actions #19

Updated by Go MAEDA almost 9 years ago

Here is a patch with tests: defect-5880.diff
Please consider merging this fix.

Actions #20

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.

Actions

Also available in: Atom PDF