Fixed: subtasks don't resepect following/precedes relations on creation (#12968).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11640 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
628f9dc4cf
commit
b1afd75620
|
@ -892,7 +892,7 @@ class Issue < ActiveRecord::Base
|
||||||
@soonest_start = nil if reload
|
@soonest_start = nil if reload
|
||||||
@soonest_start ||= (
|
@soonest_start ||= (
|
||||||
relations_to(reload).collect{|relation| relation.successor_soonest_start} +
|
relations_to(reload).collect{|relation| relation.successor_soonest_start} +
|
||||||
ancestors.collect(&:soonest_start)
|
[(@parent_issue || parent).try(:soonest_start)]
|
||||||
).compact.max
|
).compact.max
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1512,6 +1512,25 @@ class IssueTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_child_issue_should_consider_parent_soonest_start_on_create
|
||||||
|
set_language_if_valid 'en'
|
||||||
|
issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
|
||||||
|
issue2 = Issue.generate!(:start_date => '2012-10-18', :due_date => '2012-10-20')
|
||||||
|
IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
|
||||||
|
:relation_type => IssueRelation::TYPE_PRECEDES)
|
||||||
|
issue1.reload
|
||||||
|
issue2.reload
|
||||||
|
assert_equal Date.parse('2012-10-18'), issue2.start_date
|
||||||
|
|
||||||
|
child = Issue.new(:parent_issue_id => issue2.id, :start_date => '2012-10-16',
|
||||||
|
:project_id => 1, :tracker_id => 1, :status_id => 1, :subject => 'Child', :author_id => 1)
|
||||||
|
assert !child.valid?
|
||||||
|
assert_include 'Start date is invalid', child.errors.full_messages
|
||||||
|
assert_equal Date.parse('2012-10-18'), child.soonest_start
|
||||||
|
child.start_date = '2012-10-18'
|
||||||
|
assert child.save
|
||||||
|
end
|
||||||
|
|
||||||
def test_overdue
|
def test_overdue
|
||||||
assert Issue.new(:due_date => 1.day.ago.to_date).overdue?
|
assert Issue.new(:due_date => 1.day.ago.to_date).overdue?
|
||||||
assert !Issue.new(:due_date => Date.today).overdue?
|
assert !Issue.new(:due_date => Date.today).overdue?
|
||||||
|
|
Loading…
Reference in New Issue