pagination_fix_with_tests.patch

Etienne Massip, 2011-07-23 16:02

Download (1.3 KB)

View differences:

app/models/query.rb (working copy)
502 502

  
503 503
  # Returns the issue count
504 504
  def issue_count
505
    Issue.count(:include => [:status, :project], :conditions => statement)
505
    Issue.visible.count(:include => [:status, :project], :conditions => statement)
506 506
  rescue ::ActiveRecord::StatementInvalid => e
507 507
    raise StatementInvalid.new(e.message)
508 508
  end
test/unit/query_test.rb (working copy)
471 471
      q.issues(:conditions => "foo = 1")
472 472
    end
473 473
  end
474
  
474

  
475
  def test_issue_count
476
    q = Query.new(:name => '_')
477
    issue_count = q.issue_count
478
    assert_equal q.issues.size, issue_count
479
  end
480

  
481
  def test_issue_count_with_archived_issues
482
    p = Project.generate!( :status => Project::STATUS_ARCHIVED )
483
    i = Issue.generate!( :project => p, :tracker => p.trackers.first )
484
    assert !i.visible?
485

  
486
    test_issue_count
487
  end
488

  
475 489
  def test_issue_count_by_association_group
476 490
    q = Query.new(:name => '_', :group_by => 'assigned_to')
477 491
    count_by_group = q.issue_count_by_group