1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 11:37:14 +00:00

Issue Summary: add statistics about issues without assignee, version or category (#13099).

Patch by Takenori TAKAKI.


git-svn-id: http://svn.redmine.org/redmine/trunk@21309 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2021-12-12 04:40:32 +00:00
parent 8b452eb341
commit b4dbd821c9
5 changed files with 73 additions and 8 deletions

View File

@ -24,10 +24,10 @@ class ReportsController < ApplicationController
def issue_report
with_subprojects = Setting.display_subprojects_issues?
@trackers = @project.rolled_up_trackers(with_subprojects).visible
@versions = @project.shared_versions.sorted
@versions = @project.shared_versions.sorted + [Version.new(:name => "[#{l(:label_none)}]")]
@priorities = IssuePriority.all.reverse
@categories = @project.issue_categories
@assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted
@categories = @project.issue_categories + [IssueCategory.new(:name => "[#{l(:label_none)}]")]
@assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted + [User.new(:firstname => "[#{l(:label_none)}]")]
@authors = @project.users.sorted
@subprojects = @project.descendants.visible
@issues_by_tracker = Issue.by_tracker(@project, with_subprojects)
@ -51,7 +51,7 @@ class ReportsController < ApplicationController
@report_title = l(:field_tracker)
when "version"
@field = "fixed_version_id"
@rows = @project.shared_versions.sorted
@rows = @project.shared_versions.sorted + [Version.new(:name => "[#{l(:label_none)}]")]
@data = Issue.by_version(@project, with_subprojects)
@report_title = l(:field_version)
when "priority"
@ -61,12 +61,12 @@ class ReportsController < ApplicationController
@report_title = l(:field_priority)
when "category"
@field = "category_id"
@rows = @project.issue_categories
@rows = @project.issue_categories + [IssueCategory.new(:name => "[#{l(:label_none)}]")]
@data = Issue.by_category(@project, with_subprojects)
@report_title = l(:field_category)
when "assigned_to"
@field = "assigned_to_id"
@rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted
@rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted + [User.new(:firstname => "[#{l(:label_none)}]")]
@data = Issue.by_assigned_to(@project, with_subprojects)
@report_title = l(:field_assigned_to)
when "author"

View File

@ -41,7 +41,7 @@ module ReportsHelper
end
def aggregate_path(project, field, row, options={})
parameters = {:set_filter => 1, :subproject_id => '!*', field => row.id}.merge(options)
parameters = {:set_filter => 1, :subproject_id => '!*', field => (row.id || '!*')}.merge(options)
project_issues_path(row.is_a?(Project) ? row : project, parameters)
end
end

View File

@ -1585,7 +1585,7 @@ class Issue < ActiveRecord::Base
Issue.
visible(User.current, :project => options[:project], :with_subprojects => options[:with_subprojects]).
joins(:status, assoc.name).
joins(:status).
group(:status_id, :is_closed, select_field).
count.
map do |columns, total|

View File

@ -208,6 +208,30 @@ class ReportsControllerTest < Redmine::ControllerTest
end
end
def test_get_issue_report_details_by_assignee_should_show_non_assigned_issue_count
Issue.delete_all
Issue.generate!
Issue.generate!
Issue.generate!(:status_id => 5)
Issue.generate!(:assigned_to_id => 2)
get(
:issue_report_details,
:params => {
:id => 1,
:detail => 'assigned_to'
}
)
assert_select 'table.list tbody :last-child' do
assert_select 'td', :text => "[#{I18n.t(:label_none)}]"
assert_select ':nth-child(2)', :text => '2' # status:1
assert_select ':nth-child(6)', :text => '1' # status:5
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_with_an_invalid_detail
get(
:issue_report_details,

View File

@ -0,0 +1,41 @@
# frozen_string_literal: true
# Redmine - project management software
# Copyright (C) 2006-2021 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.expand_path('../../test_helper', __FILE__)
class ReportsHlperTest < Redmine::HelperTest
include ReportsHelper
include Rails.application.routes.url_helpers
fixtures :projects, :users
def test_aggregate_path_for_spacified_row
project = Project.find(1)
field = 'assigned_to_id'
row = User.find(2)
assert_equal '/projects/ecookbook/issues?assigned_to_id=2&set_filter=1&subproject_id=%21%2A', aggregate_path(project, field, row)
end
def test_aggregate_path_for_unset_row
project = Project.find(1)
field = 'assigned_to_id'
row = User.new
assert_equal '/projects/ecookbook/issues?assigned_to_id=%21%2A&set_filter=1&subproject_id=%21%2A', aggregate_path(project, field, row)
end
end