Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6740701a
Commit
6740701a
authored
Dec 14, 2021
by
Adam Hegyi
Committed by
Nikola Milojevic
Dec 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix VSA FF scope to groups
parent
dd93b837
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
3 deletions
+31
-3
ee/app/controllers/groups/analytics/cycle_analytics/summary_controller.rb
...rs/groups/analytics/cycle_analytics/summary_controller.rb
+6
-0
ee/app/services/analytics/cycle_analytics/data_loader_service.rb
...services/analytics/cycle_analytics/data_loader_service.rb
+5
-3
ee/spec/controllers/groups/analytics/cycle_analytics/summary_controller_spec.rb
...oups/analytics/cycle_analytics/summary_controller_spec.rb
+20
-0
No files found.
ee/app/controllers/groups/analytics/cycle_analytics/summary_controller.rb
View file @
6740701a
...
...
@@ -4,6 +4,7 @@ module Groups
module
Analytics
module
CycleAnalytics
class
SummaryController
<
Groups
::
Analytics
::
ApplicationController
extend
::
Gitlab
::
Utils
::
Override
include
CycleAnalyticsParams
before_action
:load_group
...
...
@@ -27,6 +28,11 @@ module Groups
def
authorize_access
return
render_403
unless
can?
(
current_user
,
:read_group_cycle_analytics
,
@group
)
end
override
:all_cycle_analytics_params
def
all_cycle_analytics_params
super
.
merge
({
group:
@group
})
end
end
end
end
...
...
ee/app/services/analytics/cycle_analytics/data_loader_service.rb
View file @
6740701a
...
...
@@ -19,6 +19,8 @@ module Analytics
@cursor
=
cursor
@updated_at_before
=
updated_at_before
@upsert_count
=
0
load_stages
# ensure stages are loaded/created
end
def
execute
...
...
@@ -54,7 +56,7 @@ module Analytics
private
attr_reader
:group
,
:model
,
:cursor
,
:updated_at_before
,
:upsert_count
attr_reader
:group
,
:model
,
:cursor
,
:updated_at_before
,
:upsert_count
,
:stages
def
error
(
error_reason
)
ServiceResponse
.
error
(
...
...
@@ -172,8 +174,8 @@ module Analytics
"column_"
+
event
.
hash_code
[
0
...
10
]
end
def
stages
@stages
||=
Gitlab
::
Analytics
::
CycleAnalytics
::
DistinctStageLoader
def
load_
stages
@stages
||=
::
Gitlab
::
Analytics
::
CycleAnalytics
::
DistinctStageLoader
.
new
(
group:
group
)
.
stages
.
select
{
|
stage
|
stage
.
start_event
.
object_type
==
model
}
...
...
ee/spec/controllers/groups/analytics/cycle_analytics/summary_controller_spec.rb
View file @
6740701a
...
...
@@ -48,5 +48,25 @@ RSpec.describe Groups::Analytics::CycleAnalytics::SummaryController do
subject
{
get
:time_summary
,
params:
params
}
it_behaves_like
'summary endpoint'
it
'passes the group to RequestParams'
do
expect_next_instance_of
(
Gitlab
::
Analytics
::
CycleAnalytics
::
RequestParams
)
do
|
instance
|
expect
(
instance
.
group
).
to
eq
(
group
)
end
subject
end
it
'uses the aggregated VSA data collector'
do
# Ensure stage_hash_id is present for Lead Time and CycleTime
Analytics
::
CycleAnalytics
::
DataLoaderService
.
new
(
group:
group
,
model:
Issue
).
execute
# Calculating Cycle Time and Lead Time
expect
(
Gitlab
::
Analytics
::
CycleAnalytics
::
Aggregated
::
DataCollector
).
to
receive
(
:new
).
twice
.
and_call_original
subject
expect
(
response
).
to
be_successful
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment