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
34b7f173
Commit
34b7f173
authored
Jul 04, 2019
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move cycle analytics model to separate namespace
parent
7301cd14
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
46 deletions
+53
-46
app/models/cycle_analytics.rb
app/models/cycle_analytics.rb
+0
-46
app/models/cycle_analytics/base.rb
app/models/cycle_analytics/base.rb
+33
-0
app/models/cycle_analytics/project_level.rb
app/models/cycle_analytics/project_level.rb
+20
-0
No files found.
app/models/cycle_analytics.rb
deleted
100644 → 0
View file @
7301cd14
# frozen_string_literal: true
class
CycleAnalytics
STAGES
=
%i[issue plan code test review staging production]
.
freeze
def
initialize
(
project
,
options
)
@project
=
project
@options
=
options
end
def
all_medians_per_stage
STAGES
.
each_with_object
({})
do
|
stage_name
,
medians_per_stage
|
medians_per_stage
[
stage_name
]
=
self
[
stage_name
].
median
end
end
def
summary
@summary
||=
::
Gitlab
::
CycleAnalytics
::
StageSummary
.
new
(
@project
,
from:
@options
[
:from
],
current_user:
@options
[
:current_user
]).
data
end
def
stats
@stats
||=
stats_per_stage
end
def
no_stats?
stats
.
all?
{
|
hash
|
hash
[
:value
].
nil?
}
end
def
permissions
(
user
:)
Gitlab
::
CycleAnalytics
::
Permissions
.
get
(
user:
user
,
project:
@project
)
end
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
app/models/cycle_analytics/base.rb
0 → 100644
View file @
34b7f173
# frozen_string_literal: true
module
CycleAnalytics
class
Base
STAGES
=
%i[issue plan code test review staging production]
.
freeze
def
all_medians_per_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
end
def
no_stats?
stats
.
all?
{
|
hash
|
hash
[
:value
].
nil?
}
end
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
0 → 100644
View file @
34b7f173
# frozen_string_literal: true
module
CycleAnalytics
class
ProjectLevel
<
Base
def
initialize
(
project
:,
options
:)
@project
=
project
@options
=
options
end
def
summary
@summary
||=
::
Gitlab
::
CycleAnalytics
::
StageSummary
.
new
(
@project
,
from:
@options
[
:from
],
current_user:
@options
[
:current_user
]).
data
end
def
permissions
(
user
:)
Gitlab
::
CycleAnalytics
::
Permissions
.
get
(
user:
user
,
project:
@project
)
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