Browse Source

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
tags/4.2.0
Go MAEDA 3 years ago
parent
commit
bdcf17ff06
2 changed files with 94 additions and 70 deletions
  1. 3
    3
      app/controllers/reports_controller.rb
  2. 91
    67
      test/functional/reports_controller_test.rb

+ 3
- 3
app/controllers/reports_controller.rb View File

@@ -22,14 +22,14 @@ class ReportsController < ApplicationController
before_action :find_project, :authorize, :find_issue_statuses

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
@priorities = IssuePriority.all.reverse
@categories = @project.issue_categories
@assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted
@authors = @project.users.sorted
@subprojects = @project.descendants.visible
with_subprojects = Setting.display_subprojects_issues?
@issues_by_tracker = Issue.by_tracker(@project, with_subprojects)
@issues_by_version = Issue.by_version(@project, with_subprojects)
@issues_by_priority = Issue.by_priority(@project, with_subprojects)
@@ -46,7 +46,7 @@ class ReportsController < ApplicationController
case params[:detail]
when "tracker"
@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)
@report_title = l(:field_tracker)
when "version"

+ 91
- 67
test/functional/reports_controller_test.rb View File

@@ -41,38 +41,50 @@ class ReportsControllerTest < Redmine::ControllerTest
end

def test_issue_report_with_subprojects_issues
Setting.stubs(:display_subprojects_issues?).returns(true)
get(
:issue_report,
:params => {
:id => 1
}
)
assert_response :success
# Count subprojects issues
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
project = Project.find(1)
tracker = project.trackers.find_by(:name => 'Support request')
project.trackers.delete(tracker)

with_settings :display_subprojects_issues => '1' do
get(
:issue_report,
:params => {
:id => 1
}
)
assert_response :success
# Count subprojects issues
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

def test_issue_report_without_subprojects_issues
Setting.stubs(:display_subprojects_issues?).returns(false)
get(
:issue_report,
:params => {
:id => 1
}
)
assert_response :success
# Do not count subprojects issues
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
project = Project.find(1)
tracker = project.trackers.find_by(:name => 'Support request')
project.trackers.delete(tracker)

with_settings :display_subprojects_issues => '0' do
get(
:issue_report,
:params => {
:id => 1
}
)
assert_response :success
# Do not count subprojects issues
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

@@ -117,50 +129,62 @@ class ReportsControllerTest < Redmine::ControllerTest
end

def test_get_issue_report_details_by_tracker_with_subprojects_issues
Setting.stubs(:display_subprojects_issues?).returns(true)
get(
:issue_report_details,
:params => {
:id => 1,
:detail => 'tracker'
}
)
assert_response :success
# Count subprojects issues
assert_select 'table.list tbody :nth-child(1)' do
assert_select 'td', :text => 'Bug'
assert_select ':nth-child(2)', :text => '5' # status:1
assert_select ':nth-child(3)', :text => '-' # status:2
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 => '5' # open
assert_select ':nth-child(9)', :text => '3' # closed
assert_select ':nth-child(10)', :text => '8' # total
project = Project.find(1)
tracker = project.trackers.find_by(:name => 'Support request')
project.trackers.delete(tracker)

with_settings :display_subprojects_issues => '1' do
get(
:issue_report_details,
:params => {
:id => 1,
:detail => 'tracker'
}
)
assert_response :success
# Count subprojects issues
assert_select 'table.list tbody :nth-child(1)' do
assert_select 'td', :text => 'Bug'
assert_select ':nth-child(2)', :text => '5' # status:1
assert_select ':nth-child(3)', :text => '-' # status:2
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 => '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

def test_get_issue_report_details_by_tracker_without_subprojects_issues
Setting.stubs(:display_subprojects_issues?).returns(false)
get :issue_report_details, :params => {
:id => 1,
:detail => 'tracker'
}
project = Project.find(1)
tracker = project.trackers.find_by(:name => 'Support request')
project.trackers.delete(tracker)

assert_response :success
# Do not count subprojects issues
assert_select 'table.list tbody :nth-child(1)' do
assert_select 'td', :text => 'Bug'
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_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
with_settings :display_subprojects_issues => '0' do
get :issue_report_details, :params => {
:id => 1,
:detail => 'tracker'
}

assert_response :success
# Do not count subprojects issues
assert_select 'table.list tbody :nth-child(1)' do
assert_select 'td', :text => 'Bug'
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_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


Loading…
Cancel
Save