]> source.dussan.org Git - redmine.git/commitdiff
Fixed: error on gantt when no issue have a due date (#6350).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 22 Oct 2010 22:13:39 +0000 (22:13 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 22 Oct 2010 22:13:39 +0000 (22:13 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4280 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/helpers/gantt.rb
test/functional/gantts_controller_test.rb

index cec32372091f8a789bd656c1c276dbc73f7cf51f..0f86648e7cbd036c381fb261e04174e9dca6dc40 100644 (file)
@@ -283,8 +283,8 @@ module Redmine
       end
 
       def line_for_project(project, options)
-        # Skip versions that don't have a start_date
-        if project.is_a?(Project) && project.start_date
+        # Skip versions that don't have a start_date or due date
+        if project.is_a?(Project) && project.start_date && project.due_date
           options[:zoom] ||= 1
           options[:g_width] ||= (self.date_to - self.date_from + 1) * options[:zoom]
 
@@ -419,7 +419,7 @@ module Redmine
 
       def line_for_version(version, options)
         # Skip versions that don't have a start_date
-        if version.is_a?(Version) && version.start_date
+        if version.is_a?(Version) && version.start_date && version.due_date
           options[:zoom] ||= 1
           options[:g_width] ||= (self.date_to - self.date_from + 1) * options[:zoom]
 
index ffc799b252b0dad22f95abae21d5d2131712c906..4c891c3d083737f51f6480a41d3aa885d4bedb01 100644 (file)
@@ -21,7 +21,7 @@ class GanttsControllerTest < ActionController::TestCase
       assert_select "div a.issue", /##{i.id}/
     end
     
-    should_eventually "work without issue due dates" do
+    should "work without issue due dates" do
       Issue.update_all("due_date = NULL")
       
       get :show, :project_id => 1
@@ -29,6 +29,16 @@ class GanttsControllerTest < ActionController::TestCase
       assert_template 'show.html.erb'
       assert_not_nil assigns(:gantt)
     end
+    
+    should "work without issue and version due dates" do
+      Issue.update_all("due_date = NULL")
+      Version.update_all("effective_date = NULL")
+      
+      get :show, :project_id => 1
+      assert_response :success
+      assert_template 'show.html.erb'
+      assert_not_nil assigns(:gantt)
+    end
 
     should "work cross project" do
       get :show