Makes Version#start_date return the minimum start_date of its issues.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4574 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -454,7 +454,7 @@ class Project < ActiveRecord::Base
|
||||
[
|
||||
issues.minimum('start_date'),
|
||||
shared_versions.collect(&:effective_date),
|
||||
shared_versions.collect {|v| v.fixed_issues.minimum('start_date')}
|
||||
shared_versions.collect(&:start_date)
|
||||
].flatten.compact.min
|
||||
end
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class Version < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def start_date
|
||||
effective_date
|
||||
@start_date ||= fixed_issues.minimum('start_date')
|
||||
end
|
||||
|
||||
def due_date
|
||||
@@ -77,8 +77,7 @@ class Version < ActiveRecord::Base
|
||||
def behind_schedule?
|
||||
if completed_pourcent == 100
|
||||
return false
|
||||
elsif due_date && fixed_issues.present? && fixed_issues.minimum('start_date') # TODO: should use #start_date but that method is wrong...
|
||||
start_date = fixed_issues.minimum('start_date')
|
||||
elsif due_date && start_date
|
||||
done_date = start_date + ((due_date - start_date+1)* completed_pourcent/100).floor
|
||||
return done_date <= Date.today
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user