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
8ccea81c
Commit
8ccea81c
authored
Aug 24, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display numbers for the "Issue (Tracker)" cycle analytics metric.
1. Code is messy and untested, but it is a start.
parent
516c838a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
app/controllers/projects/cycle_analytics_controller.rb
app/controllers/projects/cycle_analytics_controller.rb
+32
-0
app/views/projects/cycle_analytics/show.html.haml
app/views/projects/cycle_analytics/show.html.haml
+1
-0
config/routes.rb
config/routes.rb
+2
-0
No files found.
app/controllers/projects/cycle_analytics_controller.rb
0 → 100644
View file @
8ccea81c
class
Projects::CycleAnalyticsController
<
Projects
::
ApplicationController
def
show
@metrics
=
{
issue:
issue
}
end
private
def
issue
query
=
<<-
HEREDOC
WITH ordered_data AS (
SELECT extract(milliseconds FROM (COALESCE(first_associated_with_milestone_at, first_added_to_board_at) - issues.created_at)) AS data_point,
row_number() over (order by (COALESCE(first_associated_with_milestone_at, first_added_to_board_at) - issues.created_at)) as row_id
FROM issues
INNER JOIN issue_metrics ON issue_metrics.issue_id = issues.id
WHERE COALESCE(first_associated_with_milestone_at, first_added_to_board_at) IS NOT NULL
),
ct AS (
SELECT count(1) AS ct
FROM ordered_data
)
SELECT avg(data_point) AS median
FROM ordered_data
WHERE row_id between (select ct from ct)/2.0 and (select ct from ct)/2.0 + 1;
HEREDOC
ActiveRecord
::
Base
.
connection
.
execute
(
query
).
to_a
.
first
[
'median'
]
end
end
app/views/projects/cycle_analytics/show.html.haml
0 → 100644
View file @
8ccea81c
%pre
=
@metrics
config/routes.rb
View file @
8ccea81c
...
...
@@ -779,6 +779,8 @@ Rails.application.routes.draw do
resources
:environments
resource
:cycle_analytics
resources
:builds
,
only:
[
:index
,
:show
],
constraints:
{
id:
/\d+/
}
do
collection
do
post
:cancel_all
...
...
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