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
Léo-Paul Géneau
gitlab-ce
Commits
1d6068a1
Commit
1d6068a1
authored
Oct 18, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix specs - issue events working
parent
c545968e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
lib/gitlab/cycle_analytics/events.rb
lib/gitlab/cycle_analytics/events.rb
+6
-1
lib/gitlab/cycle_analytics/events_fetcher.rb
lib/gitlab/cycle_analytics/events_fetcher.rb
+1
-1
spec/lib/gitlab/cycle_analytics/events_spec.rb
spec/lib/gitlab/cycle_analytics/events_spec.rb
+5
-5
No files found.
lib/gitlab/cycle_analytics/events.rb
View file @
1d6068a1
...
...
@@ -11,9 +11,14 @@ module Gitlab
def
issue_events
@fetcher
.
fetch_issues
.
each
do
|
event
|
event
[
'issue_diff'
]
=
distance_of_time_in_words
(
event
[
'issue_diff'
].
to_f
)
event
[
'issue_diff'
]
=
interval_in_words
(
event
[
'issue_diff'
])
event
[
'created_at'
]
=
interval_in_words
(
event
[
'created_at'
])
end
end
def
interval_in_words
(
diff
)
"
#{
distance_of_time_in_words
(
diff
.
to_f
)
}
ago"
end
end
end
end
lib/gitlab/cycle_analytics/events_fetcher.rb
View file @
1d6068a1
...
...
@@ -16,7 +16,7 @@ module Gitlab
project
(
extract_epoch
(
diff_fn
).
as
(
'issue_diff'
),
*
issue_projections
).
order
(
issue_table
[
:created_at
].
desc
)
ActiveRecord
::
Base
.
connection
.
execute
(
query
.
to_sql
)
ActiveRecord
::
Base
.
connection
.
execute
(
query
.
to_sql
)
.
to_a
end
def
metric_attributes
...
...
spec/lib/gitlab/cycle_analytics/events_spec.rb
View file @
1d6068a1
...
...
@@ -15,23 +15,23 @@ describe Gitlab::CycleAnalytics::Events do
let!
(
:context
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
it
'has an issue diff'
do
expect
(
subject
.
issue_events
[
'issue_diff'
]).
to
eq
(
'2 days ago'
)
expect
(
subject
.
issue_events
.
first
[
'issue_diff'
]).
to
eq
(
'2 days ago'
)
end
it
'has a title'
do
expect
(
subject
.
issue_events
[
'title'
]).
to
eq
(
context
.
title
)
expect
(
subject
.
issue_events
.
first
[
'title'
]).
to
eq
(
context
.
title
)
end
it
'has an iid'
do
expect
(
subject
.
issue_events
[
'iid'
]).
to
eq
(
context
.
iid
.
to_s
)
expect
(
subject
.
issue_events
.
first
[
'iid'
]).
to
eq
(
context
.
iid
.
to_s
)
end
it
'has a created_at timestamp'
do
expect
(
subject
.
issue_events
[
'created_at'
]).
to
eq
(
'2 days
ago'
)
expect
(
subject
.
issue_events
.
first
[
'created_at'
]).
to
end_with
(
'
ago'
)
end
it
"has the author's name"
do
expect
(
subject
.
issue_events
[
'name'
]).
to
eq
(
context
.
author
.
name
)
expect
(
subject
.
issue_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