Project

General

Profile

Actions

Defect #5880

closed

Only consider open subtasks when computing the priority of a parent issue

Defect #5880: Only consider open subtasks when computing the priority of a parent issue

Added by Norbert Bérci over 16 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
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 6 (0 open — 6 closed)

Related to Redmine - Feature #5490: Option for independent subtask priority/start date/due date/done ratioClosedJean-Philippe LangActions
Related to Redmine - Defect #6847: Parent priorities not dropping when subtask priorities decreased.ClosedActions
Has duplicate Redmine - Feature #13736: Parent priority does not update when subtasks are closedClosedActions
Has duplicate Redmine - Feature #19921: Issue priority with subtasks : not with closed issuesClosedActions
Has duplicate Redmine - Feature #15289: Recalculate priority of a parent issue automatically after child issue is closedClosedActions
Has duplicate Redmine - Defect #14933: Parent issues default to highest priority child issue, should be highest priority *OPEN* child issueClosedActions

Updated by dimitar korudjiiski over 16 years ago Actions #1

  • % 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

Updated by Norbert Bérci over 16 years ago Actions #2

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

Updated by Norbert Bérci over 16 years ago Actions #3

  • % Done changed from 60 to 0

Updated by Ewan Makepeace about 16 years ago Actions #4

  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!)

Updated by Andreas Bosch about 16 years ago Actions #5

+1 - related to #5490 and #6847

Also see my forum post regarding this issue.

Updated by Mischa The Evil about 15 years ago Actions #6

  • Subject changed from parent task priority computation to Only consider open subtasks when computing the priority of a parent issue

Updated by Mischa The Evil about 15 years ago Actions #7

  • Category set to Issues

Updated by Ross Saad almost 14 years ago Actions #8

+1

Updated by John Pisani almost 14 years ago Actions #9

+1

Updated by Emmanuel Serau over 13 years ago Actions #10

+1

Updated by Mikołaj Milej about 13 years ago Actions #11

+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 12 years ago Actions #12

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 12 years ago Actions #13

+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 11 years ago Actions #14

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

Updated by Go MAEDA almost 11 years ago Actions #15

  • Target version set to Candidate for next major release

Updated by Go MAEDA almost 11 years ago Actions #16

  • Has duplicate Feature #15289: Recalculate priority of a parent issue automatically after child issue is closed added

Updated by Go MAEDA almost 11 years ago Actions #17

  • 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 11 years ago Actions #18

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 11 years ago Actions #19

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

Updated by Jean-Philippe Lang almost 11 years ago Actions #20

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Patch committed, thanks.

Actions

Also available in: PDF Atom