]> source.dussan.org Git - redmine.git/commitdiff
Merged r6314 from trunk (#8633).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 11 Nov 2011 11:31:49 +0000 (11:31 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 11 Nov 2011 11:31:49 +0000 (11:31 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@7765 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/unit/query_test.rb

index 1bd4ec0fb0dd0c97cc7bae6009323b76af0d9e3a..1e18ae787565780ef305b57f9292f0fd56ac1821 100644 (file)
@@ -521,7 +521,7 @@ class Query < ActiveRecord::Base
 
   # Returns the issue count
   def issue_count
-    Issue.count(:include => [:status, :project], :conditions => statement)
+    Issue.visible.count(:include => [:status, :project], :conditions => statement)
   rescue ::ActiveRecord::StatementInvalid => e
     raise StatementInvalid.new(e.message)
   end
index 27a0a37e74685bf6630ee9679ee9d59eab992199..abaf0be9d6f82191402a2b79314bfed22db5bfcc 100644 (file)
@@ -356,7 +356,21 @@ class QueryTest < ActiveSupport::TestCase
       q.issues(:conditions => "foo = 1")
     end
   end
-  
+
+  def test_issue_count
+    q = Query.new(:name => '_')
+    issue_count = q.issue_count
+    assert_equal q.issues.size, issue_count
+  end
+
+  def test_issue_count_with_archived_issues
+    p = Project.generate!( :status => Project::STATUS_ARCHIVED )
+    i = Issue.generate!( :project => p, :tracker => p.trackers.first )
+    assert !i.visible?
+
+    test_issue_count
+  end
+
   def test_issue_count_by_association_group
     q = Query.new(:name => '_', :group_by => 'assigned_to')
     count_by_group = q.issue_count_by_group