]> source.dussan.org Git - redmine.git/commitdiff
Makes Version#start_date return the minimum start_date of its issues.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 23 Dec 2010 14:58:52 +0000 (14:58 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 23 Dec 2010 14:58:52 +0000 (14:58 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4574 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb
app/models/version.rb
lib/redmine/helpers/gantt.rb

index 355ae3a4cf5bc7ab7c3d0573df0b8982f6a8436d..4af77d1d9e26fabafac50198c09f5f759bbfdbfd 100644 (file)
@@ -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
 
index 95e6ad5f6a672d7655889002fca01a3e595279b2..8b01816a76c33015623d6ac91b1b6923662ba68b 100644 (file)
@@ -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
index af0fc4c72a968d1b5a9fd3a0d67562af07ddbba7..4954434ce4855f2315f2701b2ca5b60649ade03d 100644 (file)
@@ -319,7 +319,7 @@ module Redmine
           options[:zoom] ||= 1
           options[:g_width] ||= (self.date_to - self.date_from + 1) * options[:zoom]
           
-          coords = coordinates(version.fixed_issues.minimum('start_date'), version.due_date, version.completed_pourcent, options[:zoom])
+          coords = coordinates(version.start_date, version.due_date, version.completed_pourcent, options[:zoom])
           label = "#{h version } #{h version.completed_pourcent.to_i.to_s}%"
           label = h("#{version.project} -") + label unless @project && @project == version.project