@@ -564,7 +564,7 class Query < ActiveRecord::Base | |||||
564 | r = nil |
|
564 | r = nil | |
565 | if grouped? |
|
565 | if grouped? | |
566 | begin |
|
566 | begin | |
567 | # Rails will raise an (unexpected) RecordNotFound if there's only a nil group value |
|
567 | # Rails3 will raise an (unexpected) RecordNotFound if there's only a nil group value | |
568 | r = Issue.visible.count(:group => group_by_statement, :include => [:status, :project], :conditions => statement) |
|
568 | r = Issue.visible.count(:group => group_by_statement, :include => [:status, :project], :conditions => statement) | |
569 | rescue ActiveRecord::RecordNotFound |
|
569 | rescue ActiveRecord::RecordNotFound | |
570 | r = {nil => issue_count} |
|
570 | r = {nil => issue_count} |
@@ -705,6 +705,16 class QueryTest < ActiveSupport::TestCase | |||||
705 | assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq |
|
705 | assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq | |
706 | end |
|
706 | end | |
707 |
|
707 | |||
|
708 | def test_issue_count_with_nil_group_only | |||
|
709 | Issue.update_all("assigned_to_id = NULL") | |||
|
710 | ||||
|
711 | q = Query.new(:name => '_', :group_by => 'assigned_to') | |||
|
712 | count_by_group = q.issue_count_by_group | |||
|
713 | assert_kind_of Hash, count_by_group | |||
|
714 | assert_equal 1, count_by_group.keys.size | |||
|
715 | assert_nil count_by_group.keys.first | |||
|
716 | end | |||
|
717 | ||||
708 | def test_issue_ids |
|
718 | def test_issue_ids | |
709 | q = Query.new(:name => '_') |
|
719 | q = Query.new(:name => '_') | |
710 | order = "issues.subject, issues.id" |
|
720 | order = "issues.subject, issues.id" |
General Comments 0
You need to be logged in to leave comments.
Login now