BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
747e5c3b
Commit
747e5c3b
authored
Nov 15, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use request to pass extra parameters
parent
6a2737e6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
7 deletions
+6
-7
analytics_generic_entity.rb
app/serializers/analytics_generic_entity.rb
+1
-1
events.rb
lib/gitlab/cycle_analytics/events.rb
+2
-2
analytics_generic_entity_spec.rb
spec/serializers/analytics_generic_entity_spec.rb
+2
-2
analytics_generic_serializer_spec.rb
spec/serializers/analytics_generic_serializer_spec.rb
+1
-2
No files found.
app/serializers/analytics_generic_entity.rb
View file @
747e5c3b
...
...
@@ -17,7 +17,7 @@ class AnalyticsGenericEntity < Grape::Entity
end
expose
:url
do
|
object
|
url_to
(
"namespace_project_
#{
object
[
:entity
]
}
"
.
to_sym
,
id:
object
[
:iid
].
to_s
)
url_to
(
"namespace_project_
#{
request
.
entity
}
"
.
to_sym
,
id:
object
[
:iid
].
to_s
)
end
private
...
...
lib/gitlab/cycle_analytics/events.rb
View file @
747e5c3b
...
...
@@ -49,10 +49,10 @@ module Gitlab
private
def
parse_event
(
event
)
def
parse_event
(
event
,
entity: :issue
)
event
[
'author'
]
=
User
.
find
(
event
.
remove
(
'author_id'
))
AnalyticsGenericSerializer
.
new
(
project:
@project
).
represent
(
event
).
as_json
AnalyticsGenericSerializer
.
new
(
project:
@project
,
entity:
entity
).
represent
(
event
).
as_json
end
def
parse_build_event
(
event
)
...
...
spec/serializers/analytics_generic_entity_spec.rb
View file @
747e5c3b
...
...
@@ -10,14 +10,14 @@ describe AnalyticsGenericEntity do
id:
"1"
,
created_at:
"2016-11-12 15:04:02.948604"
,
author:
user
,
entity: :merge_request
}
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:request
)
{
EntityRequest
.
new
(
project:
project
,
entity: :merge_request
)
}
let
(
:entity
)
do
described_class
.
new
(
entity_hash
,
request:
double
,
project:
project
)
described_class
.
new
(
entity_hash
,
request:
request
,
project:
project
)
end
context
'generic entity'
do
...
...
spec/serializers/analytics_generic_serializer_spec.rb
View file @
747e5c3b
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
AnalyticsGenericSerializer
do
let
(
:serializer
)
do
described_class
.
new
(
project:
project
)
.
new
(
project:
project
,
entity: :merge_request
)
.
represent
(
resource
)
end
...
...
@@ -18,7 +18,6 @@ describe AnalyticsGenericSerializer do
id:
"1"
,
created_at:
"2016-11-12 15:04:02.948604"
,
author:
user
,
entity: :merge_request
}
}
...
...
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