プロジェクト

全般

プロフィール

Vote #67613

完了

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

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2010/07/14
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
110
issue_org_id:
5880
author_id:
17380
assigned_to_id:
1
comments:
20
status_id:
5
tracker_id:
1
plus1:
6
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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

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


journals

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

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

--------------------------------------------------------------------------------
# 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!)
--------------------------------------------------------------------------------
+1 - related to #5490 and #6847

Also see "my forum post":http://www.redmine.org/boards/2/topics/19023 regarding this issue.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+1

--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+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
<pre><code class="ruby">
# 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
</code></pre>
to
<pre><code class="ruby">
# 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
</code></pre>

I know almost nothing about Ruby and RoR so there is place for improvements and bug fixes ;]

--------------------------------------------------------------------------------
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:
<pre><code class="ruby">
# 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
</code></pre>
--------------------------------------------------------------------------------
+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.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This is a patch for current trunk (r15058).

<pre><code class="diff">
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

</code></pre>
--------------------------------------------------------------------------------
Here is a patch with tests: attachment:defect-5880.diff
Please consider merging this fix.
--------------------------------------------------------------------------------
Patch committed, thanks.
--------------------------------------------------------------------------------


related_issues

relates,Closed,5490,Option for independent subtask priority/start date/due date/done ratio
relates,Closed,6847,Parent priorities not dropping when subtask priorities decreased.
duplicates,Closed,13736,Parent priority does not update when subtasks are closed
duplicates,Closed,19921,Issue priority with subtasks : not with closed issues
duplicates,Closed,15289,Recalculate priority of a parent issue automatically after child issue is closed
duplicates,Closed,14933,Parent issues default to highest priority child issue, should be highest priority *OPEN* child issue

Admin Redmine さんが3年以上前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョン3.3.0_110 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0