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
cd222357
Commit
cd222357
authored
Nov 18, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor events
parent
e56c305b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
26 deletions
+12
-26
lib/gitlab/cycle_analytics/test_event.rb
lib/gitlab/cycle_analytics/test_event.rb
+3
-17
spec/lib/gitlab/cycle_analytics/production_event_spec.rb
spec/lib/gitlab/cycle_analytics/production_event_spec.rb
+5
-5
spec/lib/gitlab/cycle_analytics/review_event_spec.rb
spec/lib/gitlab/cycle_analytics/review_event_spec.rb
+4
-4
No files found.
lib/gitlab/cycle_analytics/test_event.rb
View file @
cd222357
module
Gitlab
module
CycleAnalytics
class
TestEvent
<
Base
Event
class
TestEvent
<
Staging
Event
def
initialize
(
*
args
)
super
(
*
args
)
@stage
=
:test
@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
=
build_table
[
:created_at
]
super
(
*
args
)
end
def
custom_query
(
base_query
)
base_query
.
join
(
build_table
).
on
(
mr_metrics_table
[
:pipeline_id
].
eq
(
build_table
[
:commit_id
]))
end
private
def
serialize
(
event
)
build
=
::
Ci
::
Build
.
find
(
event
[
'id'
])
AnalyticsBuildSerializer
.
new
.
represent
(
build
).
as_json
end
end
end
...
...
spec/lib/gitlab/cycle_analytics/production_event_spec.rb
View file @
cd222357
...
...
@@ -2,9 +2,9 @@ require 'spec_helper'
require
'lib/gitlab/cycle_analytics/shared_event_spec'
describe
Gitlab
::
CycleAnalytics
::
ProductionEvent
do
it_behaves_like
'default query config'
it_behaves_like
'default query config'
do
it
'has the default order'
do
expect
(
event
.
order
).
to
eq
(
event
.
start_time_attrs
)
end
end
end
\ No newline at end of file
spec/lib/gitlab/cycle_analytics/review_event_spec.rb
View file @
cd222357
...
...
@@ -2,9 +2,9 @@ require 'spec_helper'
require
'lib/gitlab/cycle_analytics/shared_event_spec'
describe
Gitlab
::
CycleAnalytics
::
ReviewEvent
do
it_behaves_like
'default query config'
it_behaves_like
'default query config'
do
it
'has the default order'
do
expect
(
event
.
order
).
to
eq
(
event
.
start_time_attrs
)
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