Feature #13099 » 13099.patch
| app/controllers/reports_controller.rb | ||
|---|---|---|
|
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 => '[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 => '[none]')]
|
||
|
@assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted + [User.new(:firstname => '[none]')]
|
||
|
@authors = @project.users.sorted
|
||
|
@subprojects = @project.descendants.visible
|
||
|
@issues_by_tracker = Issue.by_tracker(@project, with_subprojects)
|
||
| ... | ... | |
|
@report_title = l(:field_tracker)
|
||
|
when "version"
|
||
|
@field = "fixed_version_id"
|
||
|
@rows = @project.shared_versions.sorted
|
||
|
@rows = @project.shared_versions.sorted + [Version.new(:name => '[none]')]
|
||
|
@data = Issue.by_version(@project, with_subprojects)
|
||
|
@report_title = l(:field_version)
|
||
|
when "priority"
|
||
| ... | ... | |
|
@report_title = l(:field_priority)
|
||
|
when "category"
|
||
|
@field = "category_id"
|
||
|
@rows = @project.issue_categories
|
||
|
@rows = @project.issue_categories + [IssueCategory.new(:name => '[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 => '[none]')]
|
||
|
@data = Issue.by_assigned_to(@project, with_subprojects)
|
||
|
@report_title = l(:field_assigned_to)
|
||
|
when "author"
|
||
| app/helpers/reports_helper.rb | ||
|---|---|---|
|
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
|
||
| app/models/issue.rb | ||
|---|---|---|
|
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|
|
||
| test/functional/reports_controller_test.rb | ||
|---|---|---|
|
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 => '[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,
|
||
| test/helpers/reports_helper_test.rb | ||
|---|---|---|
|
# 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
|
||