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
f6423fa4
Commit
f6423fa4
authored
Jul 08, 2019
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add code review remarks
parent
08cf6fcc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
14 deletions
+8
-14
app/models/cycle_analytics/base.rb
app/models/cycle_analytics/base.rb
+4
-10
app/models/cycle_analytics/project_level.rb
app/models/cycle_analytics/project_level.rb
+1
-1
lib/gitlab/cycle_analytics/usage_data.rb
lib/gitlab/cycle_analytics/usage_data.rb
+1
-1
spec/models/cycle_analytics/project_level_spec.rb
spec/models/cycle_analytics/project_level_spec.rb
+2
-2
No files found.
app/models/cycle_analytics/base.rb
View file @
f6423fa4
...
...
@@ -4,14 +4,16 @@ module CycleAnalytics
class
Base
STAGES
=
%i[issue plan code test review staging production]
.
freeze
def
all_medians_
per
_stage
def
all_medians_
by
_stage
STAGES
.
each_with_object
({})
do
|
stage_name
,
medians_per_stage
|
medians_per_stage
[
stage_name
]
=
self
[
stage_name
].
median
end
end
def
stats
@stats
||=
stats_per_stage
@stats
||=
STAGES
.
map
do
|
stage_name
|
self
[
stage_name
].
as_json
end
end
def
no_stats?
...
...
@@ -21,13 +23,5 @@ module CycleAnalytics
def
[]
(
stage_name
)
Gitlab
::
CycleAnalytics
::
Stage
[
stage_name
].
new
(
project:
@project
,
options:
@options
)
end
private
def
stats_per_stage
STAGES
.
map
do
|
stage_name
|
self
[
stage_name
].
as_json
end
end
end
end
app/models/cycle_analytics/project_level.rb
View file @
f6423fa4
...
...
@@ -2,7 +2,7 @@
module
CycleAnalytics
class
ProjectLevel
<
Base
def
initialize
(
project
:
,
options
:)
def
initialize
(
project
,
options
:)
@project
=
project
@options
=
options
end
...
...
lib/gitlab/cycle_analytics/usage_data.rb
View file @
f6423fa4
...
...
@@ -32,7 +32,7 @@ module Gitlab
def
medians_per_stage
projects
.
each_with_object
({})
do
|
project
,
hsh
|
::
CycleAnalytics
::
ProjectLevel
.
new
(
project:
project
,
options:
options
).
all_medians_
per
_stage
.
each
do
|
stage_name
,
median
|
::
CycleAnalytics
::
ProjectLevel
.
new
(
project:
project
,
options:
options
).
all_medians_
by
_stage
.
each
do
|
stage_name
,
median
|
hsh
[
stage_name
]
||=
[]
hsh
[
stage_name
]
<<
median
end
...
...
spec/models/cycle_analytics/project_level_spec.rb
View file @
f6423fa4
...
...
@@ -13,7 +13,7 @@ describe CycleAnalytics::ProjectLevel do
subject
{
described_class
.
new
(
project:
project
,
options:
{
from:
from_date
})
}
describe
'#all_medians_
per
_stage'
do
describe
'#all_medians_
by
_stage'
do
before
do
allow_any_instance_of
(
Gitlab
::
ReferenceExtractor
).
to
receive
(
:issues
).
and_return
([
issue
])
...
...
@@ -26,7 +26,7 @@ describe CycleAnalytics::ProjectLevel do
hsh
[
stage_name
]
=
subject
[
stage_name
].
median
.
presence
end
expect
(
subject
.
all_medians_
per
_stage
).
to
eq
(
values
)
expect
(
subject
.
all_medians_
by
_stage
).
to
eq
(
values
)
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