1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-04-05 07:21:39 +00:00

Trackers of subprojects are not displayed in the Issue summary page (#34185).

Patch by Yuichi HARADA.


git-svn-id: http://svn.redmine.org/redmine/trunk@20401 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2020-11-16 14:21:25 +00:00
parent 27aad8c10d
commit bdcf17ff06
2 changed files with 94 additions and 70 deletions

View File

@ -22,14 +22,14 @@ class ReportsController < ApplicationController
before_action :find_project, :authorize, :find_issue_statuses before_action :find_project, :authorize, :find_issue_statuses
def issue_report def issue_report
@trackers = @project.rolled_up_trackers(false).visible with_subprojects = Setting.display_subprojects_issues?
@trackers = @project.rolled_up_trackers(with_subprojects).visible
@versions = @project.shared_versions.sorted @versions = @project.shared_versions.sorted
@priorities = IssuePriority.all.reverse @priorities = IssuePriority.all.reverse
@categories = @project.issue_categories @categories = @project.issue_categories
@assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted
@authors = @project.users.sorted @authors = @project.users.sorted
@subprojects = @project.descendants.visible @subprojects = @project.descendants.visible
with_subprojects = Setting.display_subprojects_issues?
@issues_by_tracker = Issue.by_tracker(@project, with_subprojects) @issues_by_tracker = Issue.by_tracker(@project, with_subprojects)
@issues_by_version = Issue.by_version(@project, with_subprojects) @issues_by_version = Issue.by_version(@project, with_subprojects)
@issues_by_priority = Issue.by_priority(@project, with_subprojects) @issues_by_priority = Issue.by_priority(@project, with_subprojects)
@ -46,7 +46,7 @@ class ReportsController < ApplicationController
case params[:detail] case params[:detail]
when "tracker" when "tracker"
@field = "tracker_id" @field = "tracker_id"
@rows = @project.rolled_up_trackers(false).visible @rows = @project.rolled_up_trackers(with_subprojects).visible
@data = Issue.by_tracker(@project, with_subprojects) @data = Issue.by_tracker(@project, with_subprojects)
@report_title = l(:field_tracker) @report_title = l(:field_tracker)
when "version" when "version"

View File

@ -41,38 +41,50 @@ class ReportsControllerTest < Redmine::ControllerTest
end end
def test_issue_report_with_subprojects_issues def test_issue_report_with_subprojects_issues
Setting.stubs(:display_subprojects_issues?).returns(true) project = Project.find(1)
get( tracker = project.trackers.find_by(:name => 'Support request')
:issue_report, project.trackers.delete(tracker)
:params => {
:id => 1 with_settings :display_subprojects_issues => '1' do
} get(
) :issue_report,
assert_response :success :params => {
# Count subprojects issues :id => 1
assert_select 'table.list tbody :nth-child(1):first' do }
assert_select 'td', :text => 'Bug' )
assert_select ':nth-child(2)', :text => '5' # open assert_response :success
assert_select ':nth-child(3)', :text => '3' # closed # Count subprojects issues
assert_select ':nth-child(4)', :text => '8' # total assert_select 'table.list tbody :nth-child(1):first' do
assert_select 'td', :text => 'Bug'
assert_select ':nth-child(2)', :text => '5' # open
assert_select ':nth-child(3)', :text => '3' # closed
assert_select ':nth-child(4)', :text => '8' # total
end
assert_select 'table.issue-report td.name', :text => 'Support request', :count => 1
end end
end end
def test_issue_report_without_subprojects_issues def test_issue_report_without_subprojects_issues
Setting.stubs(:display_subprojects_issues?).returns(false) project = Project.find(1)
get( tracker = project.trackers.find_by(:name => 'Support request')
:issue_report, project.trackers.delete(tracker)
:params => {
:id => 1 with_settings :display_subprojects_issues => '0' do
} get(
) :issue_report,
assert_response :success :params => {
# Do not count subprojects issues :id => 1
assert_select 'table.list tbody :nth-child(1):first' do }
assert_select 'td', :text => 'Bug' )
assert_select ':nth-child(2)', :text => '3' # open assert_response :success
assert_select ':nth-child(3)', :text => '3' # closed # Do not count subprojects issues
assert_select ':nth-child(4)', :text => '6' # total assert_select 'table.list tbody :nth-child(1):first' do
assert_select 'td', :text => 'Bug'
assert_select ':nth-child(2)', :text => '3' # open
assert_select ':nth-child(3)', :text => '3' # closed
assert_select ':nth-child(4)', :text => '6' # total
end
assert_select 'table.issue-report td.name', :text => 'Support request', :count => 0
end end
end end
@ -117,50 +129,62 @@ class ReportsControllerTest < Redmine::ControllerTest
end end
def test_get_issue_report_details_by_tracker_with_subprojects_issues def test_get_issue_report_details_by_tracker_with_subprojects_issues
Setting.stubs(:display_subprojects_issues?).returns(true) project = Project.find(1)
get( tracker = project.trackers.find_by(:name => 'Support request')
:issue_report_details, project.trackers.delete(tracker)
:params => {
:id => 1, with_settings :display_subprojects_issues => '1' do
:detail => 'tracker' get(
} :issue_report_details,
) :params => {
assert_response :success :id => 1,
# Count subprojects issues :detail => 'tracker'
assert_select 'table.list tbody :nth-child(1)' do }
assert_select 'td', :text => 'Bug' )
assert_select ':nth-child(2)', :text => '5' # status:1 assert_response :success
assert_select ':nth-child(3)', :text => '-' # status:2 # Count subprojects issues
assert_select ':nth-child(4)', :text => '-' # status:3 assert_select 'table.list tbody :nth-child(1)' do
assert_select ':nth-child(5)', :text => '-' # status:4 assert_select 'td', :text => 'Bug'
assert_select ':nth-child(6)', :text => '3' # status:5 assert_select ':nth-child(2)', :text => '5' # status:1
assert_select ':nth-child(7)', :text => '-' # status:6 assert_select ':nth-child(3)', :text => '-' # status:2
assert_select ':nth-child(8)', :text => '5' # open assert_select ':nth-child(4)', :text => '-' # status:3
assert_select ':nth-child(9)', :text => '3' # closed assert_select ':nth-child(5)', :text => '-' # status:4
assert_select ':nth-child(10)', :text => '8' # total assert_select ':nth-child(6)', :text => '3' # status:5
assert_select ':nth-child(7)', :text => '-' # status:6
assert_select ':nth-child(8)', :text => '5' # open
assert_select ':nth-child(9)', :text => '3' # closed
assert_select ':nth-child(10)', :text => '8' # total
end
assert_select 'table.issue-report td.name', :text => 'Support request', :count => 1
end end
end end
def test_get_issue_report_details_by_tracker_without_subprojects_issues def test_get_issue_report_details_by_tracker_without_subprojects_issues
Setting.stubs(:display_subprojects_issues?).returns(false) project = Project.find(1)
get :issue_report_details, :params => { tracker = project.trackers.find_by(:name => 'Support request')
:id => 1, project.trackers.delete(tracker)
:detail => 'tracker'
}
assert_response :success with_settings :display_subprojects_issues => '0' do
# Do not count subprojects issues get :issue_report_details, :params => {
assert_select 'table.list tbody :nth-child(1)' do :id => 1,
assert_select 'td', :text => 'Bug' :detail => 'tracker'
assert_select ':nth-child(2)', :text => '3' # status:1 }
assert_select ':nth-child(3)', :text => '-' # status:2
assert_select ':nth-child(4)', :text => '-' # status:3 assert_response :success
assert_select ':nth-child(5)', :text => '-' # status:4 # Do not count subprojects issues
assert_select ':nth-child(6)', :text => '3' # status:5 assert_select 'table.list tbody :nth-child(1)' do
assert_select ':nth-child(7)', :text => '-' # status:6 assert_select 'td', :text => 'Bug'
assert_select ':nth-child(8)', :text => '3' # open assert_select ':nth-child(2)', :text => '3' # status:1
assert_select ':nth-child(9)', :text => '3' # closed assert_select ':nth-child(3)', :text => '-' # status:2
assert_select ':nth-child(10)', :text => '6' # total assert_select ':nth-child(4)', :text => '-' # status:3
assert_select ':nth-child(5)', :text => '-' # status:4
assert_select ':nth-child(6)', :text => '3' # status:5
assert_select ':nth-child(7)', :text => '-' # status:6
assert_select ':nth-child(8)', :text => '3' # open
assert_select ':nth-child(9)', :text => '3' # closed
assert_select ':nth-child(10)', :text => '6' # total
end
assert_select 'table.issue-report td.name', :text => 'Support request', :count => 0
end end
end end