From: Jean-Philippe Lang Date: Sun, 28 Jul 2013 16:38:09 +0000 (+0000) Subject: Fixed that open/closed counts on issues summary are not displayed with SQLServer... X-Git-Tag: 2.4.0~174 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=27c3299f328164f3e1abbece59248f1f68ef0b8c;p=redmine.git 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 --- diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index 9d52b673f..48647bcc3 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -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? diff --git a/test/functional/reports_controller_test.rb b/test/functional/reports_controller_test.rb index 56a1aca3f..25e4f7ba5 100644 --- a/test/functional/reports_controller_test.rb +++ b/test/functional/reports_controller_test.rb @@ -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)