Merged r12060 from trunk (#14369).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@12066 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-07-28 20:49:41 +00:00
parent e1e006f09e
commit dc98cec17f
2 changed files with 19 additions and 1 deletions

View File

@ -24,7 +24,7 @@ module ReportsHelper
data.each { |row|
match = 1
criteria.each { |k, v|
match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && row[k] == (v == 0 ? "f" : "t"))
match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && (v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
} unless criteria.nil?
a = a + row["total"].to_i if match == 1
} unless data.nil?

View File

@ -54,6 +54,24 @@ class ReportsControllerTest < ActionController::TestCase
end
end
def test_get_issue_report_details_by_tracker_should_show_issue_count
Issue.delete_all
Issue.generate!(:tracker_id => 1)
Issue.generate!(:tracker_id => 1)
Issue.generate!(:tracker_id => 1, :status_id => 5)
Issue.generate!(:tracker_id => 2)
get :issue_report_details, :id => 1, :detail => 'tracker'
assert_select 'table.list tbody :nth-child(1)' do
assert_select 'td', :text => 'Bug'
assert_select ':nth-child(2)', :text => '2' # status:1
assert_select ':nth-child(3)', :text => '-' # status:2
assert_select ':nth-child(8)', :text => '2' # open
assert_select ':nth-child(9)', :text => '1' # closed
assert_select ':nth-child(10)', :text => '3' # total
end
end
def test_get_issue_report_details_by_priority
get :issue_report_details, :id => 1, :detail => 'priority'
assert_equal IssuePriority.all.reverse, assigns(:rows)