Commit 72116c7d authored by Adam Hegyi's avatar Adam Hegyi

Fix PA for projects in nested groups

This change fixes the error on the group-level productivity
analytics feature when projects from sub-groups are selected.

Changelog: fixed
EE: true
parent 2a7c0a5a
...@@ -29,7 +29,7 @@ class Groups::Analytics::ApplicationController < ApplicationController ...@@ -29,7 +29,7 @@ class Groups::Analytics::ApplicationController < ApplicationController
def load_project def load_project
return unless @group && params['project_id'] return unless @group && params['project_id']
@project = find_routable!(@group.projects, params['project_id'], request.fullpath) @project = find_routable!(@group.all_projects, params['project_id'], request.fullpath)
end end
private_class_method :increment_usage_counter private_class_method :increment_usage_counter
......
...@@ -154,7 +154,7 @@ RSpec.describe Groups::Analytics::ProductivityAnalyticsController do ...@@ -154,7 +154,7 @@ RSpec.describe Groups::Analytics::ProductivityAnalyticsController do
end end
context 'for list of MRs' do context 'for list of MRs' do
let!(:merge_request ) { create :merge_request, :merged} let!(:merge_request ) { create :merge_request, :merged }
let(:serializer_mock) { instance_double('BaseSerializer') } let(:serializer_mock) { instance_double('BaseSerializer') }
...@@ -182,6 +182,23 @@ RSpec.describe Groups::Analytics::ProductivityAnalyticsController do ...@@ -182,6 +182,23 @@ RSpec.describe Groups::Analytics::ProductivityAnalyticsController do
expect(response.headers['X-Total']).to eq '1' expect(response.headers['X-Total']).to eq '1'
expect(response.headers['X-Total-Pages']).to eq '1' expect(response.headers['X-Total-Pages']).to eq '1'
end end
context 'when project from a sub-group is requested' do
let(:subgroup) { create(:group, parent: group) }
let(:project) { create(:project, group: subgroup) }
let(:params) { { group_id: group, project_id: project.full_path } }
before do
group.add_owner(current_user)
end
it 'succeeds' do
subject
expect(response).to have_gitlab_http_status(:ok)
end
end
end end
context 'for scatterplot charts' do context 'for scatterplot charts' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment