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
bd31f24c
Commit
bd31f24c
authored
Nov 04, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added branch option to test events
Also fixed test events ordering issue
parent
eccb6a5e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
11 deletions
+19
-11
app/controllers/projects/cycle_analytics/events_controller.rb
...controllers/projects/cycle_analytics/events_controller.rb
+8
-2
lib/gitlab/cycle_analytics/events.rb
lib/gitlab/cycle_analytics/events.rb
+2
-3
lib/gitlab/cycle_analytics/events_fetcher.rb
lib/gitlab/cycle_analytics/events_fetcher.rb
+2
-2
lib/gitlab/cycle_analytics/events_query.rb
lib/gitlab/cycle_analytics/events_query.rb
+3
-2
lib/gitlab/cycle_analytics/metrics_fetcher.rb
lib/gitlab/cycle_analytics/metrics_fetcher.rb
+2
-0
lib/gitlab/cycle_analytics/query_config.rb
lib/gitlab/cycle_analytics/query_config.rb
+1
-1
spec/lib/gitlab/cycle_analytics/events_spec.rb
spec/lib/gitlab/cycle_analytics/events_spec.rb
+1
-1
No files found.
app/controllers/projects/cycle_analytics/events_controller.rb
View file @
bd31f24c
...
...
@@ -17,6 +17,8 @@ class Projects::CycleAnalytics::EventsController < Projects::ApplicationControll
end
def
test
@opts
=
{
from:
start_date
,
branch:
events_params
[
:branch_name
]
}
render_events
(
builds:
events
.
test_events
)
end
...
...
@@ -54,12 +56,16 @@ class Projects::CycleAnalytics::EventsController < Projects::ApplicationControll
end
def
events
@events
||=
Gitlab
::
CycleAnalytics
::
Events
.
new
(
project:
project
,
from:
start_date
)
@events
||=
Gitlab
::
CycleAnalytics
::
Events
.
new
(
project:
project
,
options:
options
)
end
def
options
@opts
||=
{
from:
start_date
}
end
def
events_params
return
{}
unless
params
[
:events
].
present?
{
start_date:
params
[
:events
][
:start_date
]
}
{
start_date:
params
[
:events
][
:start_date
]
,
branch_name:
params
[
:events
][
:branch_name
]
}
end
end
lib/gitlab/cycle_analytics/events.rb
View file @
bd31f24c
...
...
@@ -3,10 +3,9 @@ module Gitlab
class
Events
include
ActionView
::
Helpers
::
DateHelper
def
initialize
(
project
:,
from
:)
def
initialize
(
project
:,
options
:)
@project
=
project
@from
=
from
@fetcher
=
EventsFetcher
.
new
(
project:
project
,
from:
from
)
@fetcher
=
EventsFetcher
.
new
(
project:
project
,
options:
options
)
end
def
issue_events
...
...
lib/gitlab/cycle_analytics/events_fetcher.rb
View file @
bd31f24c
...
...
@@ -3,8 +3,8 @@ module Gitlab
class
EventsFetcher
include
MetricsFetcher
def
initialize
(
project
:,
from
:)
@query
=
EventsQuery
.
new
(
project:
project
,
from:
from
)
def
initialize
(
project
:,
options
:)
@query
=
EventsQuery
.
new
(
project:
project
,
options:
options
)
end
def
fetch
(
stage
:)
...
...
lib/gitlab/cycle_analytics/events_query.rb
View file @
bd31f24c
...
...
@@ -3,9 +3,10 @@ module Gitlab
class
EventsQuery
include
MetricsFetcher
def
initialize
(
project
:,
from
:
)
def
initialize
(
project
:,
options:
{}
)
@project
=
project
@from
=
from
@from
=
options
[
:from
]
@branch
=
options
[
:branch
]
end
def
execute
(
stage
,
&
block
)
...
...
lib/gitlab/cycle_analytics/metrics_fetcher.rb
View file @
bd31f24c
...
...
@@ -38,6 +38,8 @@ module Gitlab
where
(
issue_table
[
:deleted_at
].
eq
(
nil
)).
where
(
issue_table
[
:created_at
].
gteq
(
@from
))
query
=
query
.
where
(
build_table
[
:ref
].
eq
(
@branch
))
if
name
==
:test
&&
@branch
# Load merge_requests
query
=
query
.
join
(
mr_table
,
Arel
::
Nodes
::
OuterJoin
).
on
(
mr_table
[
:id
].
eq
(
mr_closing_issues_table
[
:merge_request_id
])).
...
...
lib/gitlab/cycle_analytics/query_config.rb
View file @
bd31f24c
...
...
@@ -56,7 +56,7 @@ module Gitlab
{
start_time_attrs:
mr_metrics_table
[
:latest_build_started_at
],
end_time_attrs:
mr_metrics_table
[
:latest_build_finished_at
],
projections:
[
build_table
[
:id
]],
order:
mr
_table
[
:created_at
]
order:
build
_table
[
:created_at
]
}
end
...
...
spec/lib/gitlab/cycle_analytics/events_spec.rb
View file @
bd31f24c
...
...
@@ -6,7 +6,7 @@ describe Gitlab::CycleAnalytics::Events do
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let!
(
:context
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
subject
{
described_class
.
new
(
project:
project
,
from:
from_date
)
}
subject
{
described_class
.
new
(
project:
project
,
options:
{
from:
from_date
}
)
}
before
do
setup
(
context
)
...
...
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