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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
ca9ae8bf
Commit
ca9ae8bf
authored
Oct 27, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add email to user related queries so it can be used for displaying avatar in the UI
parent
32679232
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
13 deletions
+28
-13
app/controllers/projects/cycle_analytics/events_controller.rb
...controllers/projects/cycle_analytics/events_controller.rb
+8
-8
lib/gitlab/cycle_analytics/events.rb
lib/gitlab/cycle_analytics/events.rb
+0
-1
lib/gitlab/cycle_analytics/events_fetcher.rb
lib/gitlab/cycle_analytics/events_fetcher.rb
+4
-4
spec/lib/gitlab/cycle_analytics/events_spec.rb
spec/lib/gitlab/cycle_analytics/events_spec.rb
+16
-0
No files found.
app/controllers/projects/cycle_analytics/events_controller.rb
View file @
ca9ae8bf
class
Projects::CycleAnalytics::EventsController
<
Projects
::
ApplicationController
class
Projects::CycleAnalytics::EventsController
<
Projects
::
ApplicationController
#before_action :authorize_read_cycle_analytics!
#
before_action :authorize_read_cycle_analytics!
def
issue
def
issue
render_events
(
events
.
issue_events
)
render_events
(
events
.
issue_events
)
...
@@ -41,12 +41,12 @@ class Projects::CycleAnalytics::EventsController < Projects::ApplicationControll
...
@@ -41,12 +41,12 @@ class Projects::CycleAnalytics::EventsController < Projects::ApplicationControll
# TODO refactor this
# TODO refactor this
def
start_date
def
start_date
case
events_params
[
:start_date
]
case
events_params
[
:start_date
]
when
'30'
then
when
'30'
then
30
.
days
.
ago
30
.
days
.
ago
when
'90'
then
when
'90'
then
90
.
days
.
ago
90
.
days
.
ago
else
else
90
.
days
.
ago
90
.
days
.
ago
end
end
end
end
...
@@ -59,4 +59,4 @@ class Projects::CycleAnalytics::EventsController < Projects::ApplicationControll
...
@@ -59,4 +59,4 @@ class Projects::CycleAnalytics::EventsController < Projects::ApplicationControll
{
start_date:
params
[
:events
][
:start_date
]
}
{
start_date:
params
[
:events
][
:start_date
]
}
end
end
end
end
\ No newline at end of file
lib/gitlab/cycle_analytics/events.rb
View file @
ca9ae8bf
...
@@ -10,7 +10,6 @@ module Gitlab
...
@@ -10,7 +10,6 @@ module Gitlab
end
end
# TODO: backend pagination - specially for commits, etc...
# TODO: backend pagination - specially for commits, etc...
# TODO figure out what the frontend needs for displaying the avatar
def
issue_events
def
issue_events
@fetcher
.
fetch
(
stage: :issue
).
each
{
|
event
|
parse_event
(
event
)
}
@fetcher
.
fetch
(
stage: :issue
).
each
{
|
event
|
parse_event
(
event
)
}
...
...
lib/gitlab/cycle_analytics/events_fetcher.rb
View file @
ca9ae8bf
...
@@ -8,7 +8,7 @@ module Gitlab
...
@@ -8,7 +8,7 @@ module Gitlab
start_time_attrs:
issue_table
[
:created_at
],
start_time_attrs:
issue_table
[
:created_at
],
end_time_attrs:
[
issue_metrics_table
[
:first_associated_with_milestone_at
],
end_time_attrs:
[
issue_metrics_table
[
:first_associated_with_milestone_at
],
issue_metrics_table
[
:first_added_to_board_at
]],
issue_metrics_table
[
:first_added_to_board_at
]],
projections:
[
issue_table
[
:title
],
issue_table
[
:iid
],
issue_table
[
:created_at
],
user_table
[
:name
]]
projections:
[
issue_table
[
:title
],
issue_table
[
:iid
],
issue_table
[
:created_at
],
user_table
[
:name
]
,
user_table
[
:email
]
]
},
},
plan:
{
plan:
{
start_time_attrs:
issue_metrics_table
[
:first_associated_with_milestone_at
],
start_time_attrs:
issue_metrics_table
[
:first_associated_with_milestone_at
],
...
@@ -19,7 +19,7 @@ module Gitlab
...
@@ -19,7 +19,7 @@ module Gitlab
code:
{
code:
{
start_time_attrs:
issue_metrics_table
[
:first_mentioned_in_commit_at
],
start_time_attrs:
issue_metrics_table
[
:first_mentioned_in_commit_at
],
end_time_attrs:
mr_table
[
:created_at
],
end_time_attrs:
mr_table
[
:created_at
],
projections:
[
mr_table
[
:title
],
mr_table
[
:iid
],
mr_table
[
:created_at
],
user_table
[
:name
]],
projections:
[
mr_table
[
:title
],
mr_table
[
:iid
],
mr_table
[
:created_at
],
user_table
[
:name
]
,
user_table
[
:email
]
],
order:
mr_table
[
:created_at
]
order:
mr_table
[
:created_at
]
},
},
test:
{
test:
{
...
@@ -31,7 +31,7 @@ module Gitlab
...
@@ -31,7 +31,7 @@ module Gitlab
review:
{
review:
{
start_time_attrs:
mr_table
[
:created_at
],
start_time_attrs:
mr_table
[
:created_at
],
end_time_attrs:
mr_metrics_table
[
:merged_at
],
end_time_attrs:
mr_metrics_table
[
:merged_at
],
projections:
[
mr_table
[
:title
],
mr_table
[
:iid
],
mr_table
[
:created_at
],
user_table
[
:name
]]
projections:
[
mr_table
[
:title
],
mr_table
[
:iid
],
mr_table
[
:created_at
],
user_table
[
:name
]
,
user_table
[
:email
]
]
},
},
staging:
{
staging:
{
start_time_attrs:
mr_metrics_table
[
:merged_at
],
start_time_attrs:
mr_metrics_table
[
:merged_at
],
...
@@ -41,7 +41,7 @@ module Gitlab
...
@@ -41,7 +41,7 @@ module Gitlab
production:
{
production:
{
start_time_attrs:
issue_table
[
:created_at
],
start_time_attrs:
issue_table
[
:created_at
],
end_time_attrs:
mr_metrics_table
[
:first_deployed_to_production_at
],
end_time_attrs:
mr_metrics_table
[
:first_deployed_to_production_at
],
projections:
[
issue_table
[
:title
],
issue_table
[
:iid
],
issue_table
[
:created_at
],
user_table
[
:name
]]
projections:
[
issue_table
[
:title
],
issue_table
[
:iid
],
issue_table
[
:created_at
],
user_table
[
:name
]
,
user_table
[
:email
]
]
},
},
}.
freeze
}.
freeze
...
...
spec/lib/gitlab/cycle_analytics/events_spec.rb
View file @
ca9ae8bf
...
@@ -30,6 +30,10 @@ describe Gitlab::CycleAnalytics::Events do
...
@@ -30,6 +30,10 @@ describe Gitlab::CycleAnalytics::Events do
expect
(
subject
.
issue_events
.
first
[
'created_at'
]).
to
end_with
(
'ago'
)
expect
(
subject
.
issue_events
.
first
[
'created_at'
]).
to
end_with
(
'ago'
)
end
end
it
"has the author's email"
do
expect
(
subject
.
issue_events
.
first
[
'email'
]).
to
eq
(
context
.
author
.
email
)
end
it
"has the author's name"
do
it
"has the author's name"
do
expect
(
subject
.
issue_events
.
first
[
'name'
]).
to
eq
(
context
.
author
.
name
)
expect
(
subject
.
issue_events
.
first
[
'name'
]).
to
eq
(
context
.
author
.
name
)
end
end
...
@@ -70,6 +74,10 @@ describe Gitlab::CycleAnalytics::Events do
...
@@ -70,6 +74,10 @@ describe Gitlab::CycleAnalytics::Events do
expect
(
subject
.
code_events
.
first
[
'created_at'
]).
to
end_with
(
'ago'
)
expect
(
subject
.
code_events
.
first
[
'created_at'
]).
to
end_with
(
'ago'
)
end
end
it
"has the author's email"
do
expect
(
subject
.
code_events
.
first
[
'email'
]).
to
eq
(
context
.
author
.
email
)
end
it
"has the author's name"
do
it
"has the author's name"
do
expect
(
subject
.
code_events
.
first
[
'name'
]).
to
eq
(
context
.
author
.
name
)
expect
(
subject
.
code_events
.
first
[
'name'
]).
to
eq
(
context
.
author
.
name
)
end
end
...
@@ -118,6 +126,10 @@ describe Gitlab::CycleAnalytics::Events do
...
@@ -118,6 +126,10 @@ describe Gitlab::CycleAnalytics::Events do
expect
(
subject
.
review_events
.
first
[
'created_at'
]).
to
end_with
(
'ago'
)
expect
(
subject
.
review_events
.
first
[
'created_at'
]).
to
end_with
(
'ago'
)
end
end
it
"has the author's email"
do
expect
(
subject
.
review_events
.
first
[
'email'
]).
to
eq
(
MergeRequest
.
first
.
author
.
email
)
end
it
"has the author's name"
do
it
"has the author's name"
do
expect
(
subject
.
review_events
.
first
[
'name'
]).
to
eq
(
MergeRequest
.
first
.
author
.
name
)
expect
(
subject
.
review_events
.
first
[
'name'
]).
to
eq
(
MergeRequest
.
first
.
author
.
name
)
end
end
...
@@ -173,6 +185,10 @@ describe Gitlab::CycleAnalytics::Events do
...
@@ -173,6 +185,10 @@ describe Gitlab::CycleAnalytics::Events do
expect
(
subject
.
production_events
.
first
[
'created_at'
]).
to
end_with
(
'ago'
)
expect
(
subject
.
production_events
.
first
[
'created_at'
]).
to
end_with
(
'ago'
)
end
end
it
"has the author's email"
do
expect
(
subject
.
production_events
.
first
[
'email'
]).
to
eq
(
context
.
author
.
email
)
end
it
"has the author's name"
do
it
"has the author's name"
do
expect
(
subject
.
production_events
.
first
[
'name'
]).
to
eq
(
context
.
author
.
name
)
expect
(
subject
.
production_events
.
first
[
'name'
]).
to
eq
(
context
.
author
.
name
)
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