@@ -1534,10 +1534,11 class Issue < ActiveRecord::Base | |||
|
1534 | 1534 | if issue_id && p = Issue.find_by_id(issue_id) |
|
1535 | 1535 | if p.priority_derived? |
|
1536 | 1536 | # priority = highest priority of open children |
|
1537 | # priority is left unchanged if all children are closed and there's no default priority defined | |
|
1537 | 1538 | if priority_position = p.children.open.joins(:priority).maximum("#{IssuePriority.table_name}.position") |
|
1538 | 1539 | p.priority = IssuePriority.find_by_position(priority_position) |
|
1539 | else | |
|
1540 |
p.priority = |
|
|
1540 | elsif default_priority = IssuePriority.default | |
|
1541 | p.priority = default_priority | |
|
1541 | 1542 | end |
|
1542 | 1543 | end |
|
1543 | 1544 |
@@ -108,6 +108,30 class IssueSubtaskingTest < ActiveSupport::TestCase | |||
|
108 | 108 | end |
|
109 | 109 | end |
|
110 | 110 | |
|
111 | def test_parent_priority_should_be_set_to_default_when_all_children_are_closed | |
|
112 | with_settings :parent_issue_priority => 'derived' do | |
|
113 | parent = Issue.generate! | |
|
114 | child = parent.generate_child!(:priority => IssuePriority.find_by_name('High')) | |
|
115 | assert_equal 'High', parent.reload.priority.name | |
|
116 | child.status = IssueStatus.where(:is_closed => true).first | |
|
117 | child.save! | |
|
118 | assert_equal 'Normal', parent.reload.priority.name | |
|
119 | end | |
|
120 | end | |
|
121 | ||
|
122 | def test_parent_priority_should_be_left_unchanged_when_all_children_are_closed_and_no_default_priority | |
|
123 | IssuePriority.update_all :is_default => false | |
|
124 | ||
|
125 | with_settings :parent_issue_priority => 'derived' do | |
|
126 | parent = Issue.generate!(:priority => IssuePriority.find_by_name('Normal')) | |
|
127 | child = parent.generate_child!(:priority => IssuePriority.find_by_name('High')) | |
|
128 | assert_equal 'High', parent.reload.priority.name | |
|
129 | child.status = IssueStatus.where(:is_closed => true).first | |
|
130 | child.save! | |
|
131 | assert_equal 'High', parent.reload.priority.name | |
|
132 | end | |
|
133 | end | |
|
134 | ||
|
111 | 135 | def test_parent_done_ratio_should_be_read_only_with_parent_issue_done_ratio_set_to_derived |
|
112 | 136 | with_settings :parent_issue_done_ratio => 'derived' do |
|
113 | 137 | issue = Issue.generate_with_child! |
General Comments 0
You need to be logged in to leave comments.
Login now