Fixed that open/closed counts on issues summary are not displayed with SQLServer (#14369).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12060 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-07-28 16:38:09 +00:00
parent df7e56b13c
commit 27c3299f32
2 changed files with 19 additions and 1 deletions

View File

@ -24,7 +24,7 @@ module ReportsHelper
data.each { |row| data.each { |row|
match = 1 match = 1
criteria.each { |k, v| 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? } unless criteria.nil?
a = a + row["total"].to_i if match == 1 a = a + row["total"].to_i if match == 1
} unless data.nil? } unless data.nil?

View File

@ -54,6 +54,24 @@ class ReportsControllerTest < ActionController::TestCase
end end
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 def test_get_issue_report_details_by_priority
get :issue_report_details, :id => 1, :detail => 'priority' get :issue_report_details, :id => 1, :detail => 'priority'
assert_equal IssuePriority.all.reverse, assigns(:rows) assert_equal IssuePriority.all.reverse, assigns(:rows)