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
Boxiang Sun
gitlab-ce
Commits
f8acc7ea
Commit
f8acc7ea
authored
Oct 21, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing spec failures
parent
d99cec7f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
10 deletions
+11
-10
lib/gitlab/cycle_analytics/events.rb
lib/gitlab/cycle_analytics/events.rb
+4
-4
lib/gitlab/database/date_time.rb
lib/gitlab/database/date_time.rb
+1
-1
spec/lib/gitlab/cycle_analytics/events_spec.rb
spec/lib/gitlab/cycle_analytics/events_spec.rb
+6
-5
No files found.
lib/gitlab/cycle_analytics/events.rb
View file @
f8acc7ea
...
@@ -13,7 +13,7 @@ module Gitlab
...
@@ -13,7 +13,7 @@ module Gitlab
def
issue_events
def
issue_events
# TODO figure out what the frontend needs for displaying the avatar
# TODO figure out what the frontend needs for displaying the avatar
@fetcher
.
fetch_issue_events
{
|
event
|
parse_event
(
event
)
}
@fetcher
.
fetch_issue_events
.
each
{
|
event
|
parse_event
(
event
)
}
end
end
def
plan_events
def
plan_events
...
@@ -25,7 +25,7 @@ module Gitlab
...
@@ -25,7 +25,7 @@ module Gitlab
end
end
def
code_events
def
code_events
@fetcher
.
fetch_code_events
{
|
event
|
parse_event
(
event
)
}
@fetcher
.
fetch_code_events
.
each
{
|
event
|
parse_event
(
event
)
}
end
end
def
test_events
def
test_events
...
@@ -39,13 +39,13 @@ module Gitlab
...
@@ -39,13 +39,13 @@ module Gitlab
@fetcher
.
fetch_review_events
.
each
{
|
event
|
parse_event
(
event
)
}
@fetcher
.
fetch_review_events
.
each
{
|
event
|
parse_event
(
event
)
}
end
end
private
def
parse_event
(
event
)
def
parse_event
(
event
)
event
[
'total_time'
]
=
distance_of_time_in_words
(
event
[
'total_time'
].
to_f
)
event
[
'total_time'
]
=
distance_of_time_in_words
(
event
[
'total_time'
].
to_f
)
event
[
'created_at'
]
=
interval_in_words
(
event
[
'created_at'
])
event
[
'created_at'
]
=
interval_in_words
(
event
[
'created_at'
])
end
end
private
def
first_time_reference_commit
(
commits
,
event
)
def
first_time_reference_commit
(
commits
,
event
)
st_commit
=
YAML
.
load
(
commits
).
detect
do
|
commit
|
st_commit
=
YAML
.
load
(
commits
).
detect
do
|
commit
|
commit
[
'created_at'
]
==
event
[
'first_mentioned_in_commit_at'
]
commit
[
'created_at'
]
==
event
[
'first_mentioned_in_commit_at'
]
...
...
lib/gitlab/database/date_time.rb
View file @
f8acc7ea
...
@@ -8,7 +8,7 @@ module Gitlab
...
@@ -8,7 +8,7 @@ module Gitlab
# Note: For MySQL, the interval is returned in seconds.
# Note: For MySQL, the interval is returned in seconds.
# For PostgreSQL, the interval is returned as an INTERVAL type.
# For PostgreSQL, the interval is returned as an INTERVAL type.
def
subtract_datetimes
(
query_so_far
,
start_time_attrs
,
end_time_attrs
,
as
)
def
subtract_datetimes
(
query_so_far
,
start_time_attrs
,
end_time_attrs
,
as
)
diff_fn
=
subtract_datetimes_diff
(
query_so_far
,
end_time_attrs
,
start
_time_attrs
)
diff_fn
=
subtract_datetimes_diff
(
query_so_far
,
start_time_attrs
,
end
_time_attrs
)
query_so_far
.
project
(
diff_fn
.
as
(
as
))
query_so_far
.
project
(
diff_fn
.
as
(
as
))
end
end
...
...
spec/lib/gitlab/cycle_analytics/events_spec.rb
View file @
f8acc7ea
...
@@ -78,10 +78,12 @@ describe Gitlab::CycleAnalytics::Events do
...
@@ -78,10 +78,12 @@ describe Gitlab::CycleAnalytics::Events do
describe
'#test_events'
do
describe
'#test_events'
do
let!
(
:context
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
let!
(
:context
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
let
(
:merge_request
)
{
MergeRequest
.
first
}
let
(
:merge_request
)
{
MergeRequest
.
first
}
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
let!
(
:pipeline
)
do
ref:
merge_request
.
source_branch
,
create
(
:ci_pipeline
,
sha:
merge_request
.
diff_head_sha
,
ref:
merge_request
.
source_branch
,
project:
context
.
project
)
}
sha:
merge_request
.
diff_head_sha
,
project:
context
.
project
)
end
before
do
before
do
pipeline
.
run!
pipeline
.
run!
...
@@ -121,7 +123,6 @@ describe Gitlab::CycleAnalytics::Events do
...
@@ -121,7 +123,6 @@ describe Gitlab::CycleAnalytics::Events do
end
end
end
end
def
setup
(
context
)
def
setup
(
context
)
milestone
=
create
(
:milestone
,
project:
project
)
milestone
=
create
(
:milestone
,
project:
project
)
context
.
update
(
milestone:
milestone
)
context
.
update
(
milestone:
milestone
)
...
...
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