##// END OF EJS Templates
Fixed that open/closed counts on issues summary are not displayed with SQLServer (#14369)....
Jean-Philippe Lang -
r11830:27c3299f3281
parent child
Show More
@@ -1,43 +1,43
1 1 # encoding: utf-8
2 2 #
3 3 # Redmine - project management software
4 4 # Copyright (C) 2006-2013 Jean-Philippe Lang
5 5 #
6 6 # This program is free software; you can redistribute it and/or
7 7 # modify it under the terms of the GNU General Public License
8 8 # as published by the Free Software Foundation; either version 2
9 9 # of the License, or (at your option) any later version.
10 10 #
11 11 # This program is distributed in the hope that it will be useful,
12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 14 # GNU General Public License for more details.
15 15 #
16 16 # You should have received a copy of the GNU General Public License
17 17 # along with this program; if not, write to the Free Software
18 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 19
20 20 module ReportsHelper
21 21
22 22 def aggregate(data, criteria)
23 23 a = 0
24 24 data.each { |row|
25 25 match = 1
26 26 criteria.each { |k, v|
27 match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && row[k] == (v == 0 ? "f" : "t"))
27 match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && (v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
28 28 } unless criteria.nil?
29 29 a = a + row["total"].to_i if match == 1
30 30 } unless data.nil?
31 31 a
32 32 end
33 33
34 34 def aggregate_link(data, criteria, *args)
35 35 a = aggregate data, criteria
36 36 a > 0 ? link_to(h(a), *args) : '-'
37 37 end
38 38
39 39 def aggregate_path(project, field, row, options={})
40 40 parameters = {:set_filter => 1, :subproject_id => '!*', field => row.id}.merge(options)
41 41 project_issues_path(row.is_a?(Project) ? row : project, parameters)
42 42 end
43 43 end
@@ -1,67 +1,85
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class ReportsControllerTest < ActionController::TestCase
21 21 fixtures :projects, :trackers, :issue_statuses, :issues,
22 22 :enumerations, :users, :issue_categories,
23 23 :projects_trackers,
24 24 :roles,
25 25 :member_roles,
26 26 :members,
27 27 :enabled_modules,
28 28 :versions
29 29
30 30 def test_get_issue_report
31 31 get :issue_report, :id => 1
32 32
33 33 assert_response :success
34 34 assert_template 'issue_report'
35 35
36 36 [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to,
37 37 :issues_by_author, :issues_by_subproject, :issues_by_priority].each do |ivar|
38 38 assert_not_nil assigns(ivar)
39 39 end
40 40
41 41 assert_equal IssuePriority.all.reverse, assigns(:priorities)
42 42 end
43 43
44 44 def test_get_issue_report_details
45 45 %w(tracker version priority category assigned_to author subproject).each do |detail|
46 46 get :issue_report_details, :id => 1, :detail => detail
47 47
48 48 assert_response :success
49 49 assert_template 'issue_report_details'
50 50 assert_not_nil assigns(:field)
51 51 assert_not_nil assigns(:rows)
52 52 assert_not_nil assigns(:data)
53 53 assert_not_nil assigns(:report_title)
54 54 end
55 55 end
56 56
57 def test_get_issue_report_details_by_tracker_should_show_issue_count
58 Issue.delete_all
59 Issue.generate!(:tracker_id => 1)
60 Issue.generate!(:tracker_id => 1)
61 Issue.generate!(:tracker_id => 1, :status_id => 5)
62 Issue.generate!(:tracker_id => 2)
63
64 get :issue_report_details, :id => 1, :detail => 'tracker'
65 assert_select 'table.list tbody :nth-child(1)' do
66 assert_select 'td', :text => 'Bug'
67 assert_select ':nth-child(2)', :text => '2' # status:1
68 assert_select ':nth-child(3)', :text => '-' # status:2
69 assert_select ':nth-child(8)', :text => '2' # open
70 assert_select ':nth-child(9)', :text => '1' # closed
71 assert_select ':nth-child(10)', :text => '3' # total
72 end
73 end
74
57 75 def test_get_issue_report_details_by_priority
58 76 get :issue_report_details, :id => 1, :detail => 'priority'
59 77 assert_equal IssuePriority.all.reverse, assigns(:rows)
60 78 end
61 79
62 80 def test_get_issue_report_details_with_an_invalid_detail
63 81 get :issue_report_details, :id => 1, :detail => 'invalid'
64 82
65 83 assert_redirected_to '/projects/ecookbook/issues/report'
66 84 end
67 85 end
General Comments 0
You need to be logged in to leave comments. Login now