]> source.dussan.org Git - redmine.git/commitdiff
Select projects with issue_tracking module for gantt display and remove the nil start...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 7 Dec 2010 19:42:36 +0000 (19:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 7 Dec 2010 19:42:36 +0000 (19:42 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4477 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb
lib/redmine/helpers/gantt.rb
test/unit/project_test.rb

index d68958e27d8922fb4ac9572f24a173d7dab5d9f3..805e29414145e76df2e9cc0cb2aa037d00f5d583 100644 (file)
@@ -449,24 +449,20 @@ class Project < ActiveRecord::Base
 
   # The earliest start date of a project, based on it's issues and versions
   def start_date
-    if module_enabled?(:issue_tracking)
-      [
-       issues.minimum('start_date'),
-       shared_versions.collect(&:effective_date),
-       shared_versions.collect {|v| v.fixed_issues.minimum('start_date')}
-      ].flatten.compact.min
-    end
+    [
+     issues.minimum('start_date'),
+     shared_versions.collect(&:effective_date),
+     shared_versions.collect {|v| v.fixed_issues.minimum('start_date')}
+    ].flatten.compact.min
   end
 
   # The latest due date of an issue or version
   def due_date
-    if module_enabled?(:issue_tracking)
-      [
-       issues.maximum('due_date'),
-       shared_versions.collect(&:effective_date),
-       shared_versions.collect {|v| v.fixed_issues.maximum('due_date')}
-      ].flatten.compact.max
-    end
+    [
+     issues.maximum('due_date'),
+     shared_versions.collect(&:effective_date),
+     shared_versions.collect {|v| v.fixed_issues.maximum('due_date')}
+    ].flatten.compact.max
   end
 
   def overdue?
index 274b4442fcf986978903933d8e55078d4a73ac8c..79088dfe54736b22073aabbf1e3dd284f5da602d 100644 (file)
@@ -97,7 +97,7 @@ module Redmine
         if @project
           return number_of_rows_on_project(@project)
         else
-          Project.roots.visible.inject(0) do |total, project|
+          Project.roots.visible.has_module('issue_tracking').inject(0) do |total, project|
             total += number_of_rows_on_project(project)
           end
         end
@@ -125,7 +125,7 @@ module Redmine
         end
 
         # Subprojects
-        project.children.visible.each do |subproject|
+        project.children.visible.has_module('issue_tracking').each do |subproject|
           count += number_of_rows_on_project(subproject)
         end
 
@@ -154,7 +154,7 @@ module Redmine
         if @project
           render_project(@project, options)
         else
-          Project.roots.visible.each do |project|
+          Project.roots.visible.has_module('issue_tracking').each do |project|
             render_project(project, options)
           end
         end
@@ -190,7 +190,7 @@ module Redmine
         end
 
         # Fourth, subprojects
-        project.children.visible.each do |project|
+        project.children.visible.has_module('issue_tracking').each do |project|
           render_project(project, options)
         end
 
index c77d7e61d33a4e673414b59ef3cf047eb7d27e2d..87452ceb9f6eb80b790407ac9762f17fd5101e62 100644 (file)
@@ -882,14 +882,6 @@ class ProjectTest < ActiveSupport::TestCase
     should "be nil if there are no issues on the project" do
       assert_nil @project.start_date
     end
-
-    should "be nil if issue tracking is disabled" do
-      Issue.generate_for_project!(@project, :start_date => Date.today)
-      @project.enabled_modules.find_all_by_name('issue_tracking').each {|m| m.destroy}
-      @project.reload
-      
-      assert_nil @project.start_date
-    end
     
     should "be tested when issues have no start date"
 
@@ -913,14 +905,6 @@ class ProjectTest < ActiveSupport::TestCase
     should "be nil if there are no issues on the project" do
       assert_nil @project.due_date
     end
-
-    should "be nil if issue tracking is disabled" do
-      Issue.generate_for_project!(@project, :due_date => Date.today)
-      @project.enabled_modules.find_all_by_name('issue_tracking').each {|m| m.destroy}
-      @project.reload
-      
-      assert_nil @project.due_date
-    end
     
     should "be tested when issues have no due date"