##// END OF EJS Templates
Merged r4467 from trunk...
Jean-Philippe Lang -
r4449:0bff40c1e177
parent child
Show More
@@ -84,14 +84,15 class IssueRelation < ActiveRecord::Base
84
84
85 def set_issue_to_dates
85 def set_issue_to_dates
86 soonest_start = self.successor_soonest_start
86 soonest_start = self.successor_soonest_start
87 if soonest_start
87 if soonest_start && issue_to
88 issue_to.reschedule_after(soonest_start)
88 issue_to.reschedule_after(soonest_start)
89 end
89 end
90 end
90 end
91
91
92 def successor_soonest_start
92 def successor_soonest_start
93 return nil unless (TYPE_PRECEDES == self.relation_type) && (issue_from.start_date || issue_from.due_date)
93 if (TYPE_PRECEDES == self.relation_type) && delay && issue_from && (issue_from.start_date || issue_from.due_date)
94 (issue_from.due_date || issue_from.start_date) + 1 + delay
94 (issue_from.due_date || issue_from.start_date) + 1 + delay
95 end
95 end
96 end
96
97
97 def <=>(relation)
98 def <=>(relation)
@@ -63,4 +63,14 class IssueRelationTest < ActiveSupport::TestCase
63 assert_equal IssueRelation::TYPE_PRECEDES, relation.relation_type_for(from)
63 assert_equal IssueRelation::TYPE_PRECEDES, relation.relation_type_for(from)
64 assert_equal IssueRelation::TYPE_FOLLOWS, relation.relation_type_for(to)
64 assert_equal IssueRelation::TYPE_FOLLOWS, relation.relation_type_for(to)
65 end
65 end
66
67 def test_set_issue_to_dates_without_issue_to
68 r = IssueRelation.new(:issue_from => Issue.new(:start_date => Date.today), :relation_type => IssueRelation::TYPE_PRECEDES, :delay => 1)
69 assert_nil r.set_issue_to_dates
70 end
71
72 def test_set_issue_to_dates_without_issues
73 r = IssueRelation.new(:relation_type => IssueRelation::TYPE_PRECEDES, :delay => 1)
74 assert_nil r.set_issue_to_dates
75 end
66 end
76 end
General Comments 0
You need to be logged in to leave comments. Login now