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
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
def
issue_events
# 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
def
plan_events
...
...
@@ -25,7 +25,7 @@ module Gitlab
end
def
code_events
@fetcher
.
fetch_code_events
{
|
event
|
parse_event
(
event
)
}
@fetcher
.
fetch_code_events
.
each
{
|
event
|
parse_event
(
event
)
}
end
def
test_events
...
...
@@ -39,13 +39,13 @@ module Gitlab
@fetcher
.
fetch_review_events
.
each
{
|
event
|
parse_event
(
event
)
}
end
private
def
parse_event
(
event
)
event
[
'total_time'
]
=
distance_of_time_in_words
(
event
[
'total_time'
].
to_f
)
event
[
'created_at'
]
=
interval_in_words
(
event
[
'created_at'
])
end
private
def
first_time_reference_commit
(
commits
,
event
)
st_commit
=
YAML
.
load
(
commits
).
detect
do
|
commit
|
commit
[
'created_at'
]
==
event
[
'first_mentioned_in_commit_at'
]
...
...
lib/gitlab/database/date_time.rb
View file @
f8acc7ea
...
...
@@ -8,7 +8,7 @@ module Gitlab
# Note: For MySQL, the interval is returned in seconds.
# For PostgreSQL, the interval is returned as an INTERVAL type.
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
))
end
...
...
spec/lib/gitlab/cycle_analytics/events_spec.rb
View file @
f8acc7ea
...
...
@@ -78,10 +78,12 @@ describe Gitlab::CycleAnalytics::Events do
describe
'#test_events'
do
let!
(
:context
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
let
(
:merge_request
)
{
MergeRequest
.
first
}
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
ref:
merge_request
.
source_branch
,
sha:
merge_request
.
diff_head_sha
,
project:
context
.
project
)
}
let!
(
:pipeline
)
do
create
(
:ci_pipeline
,
ref:
merge_request
.
source_branch
,
sha:
merge_request
.
diff_head_sha
,
project:
context
.
project
)
end
before
do
pipeline
.
run!
...
...
@@ -121,7 +123,6 @@ describe Gitlab::CycleAnalytics::Events do
end
end
def
setup
(
context
)
milestone
=
create
(
:milestone
,
project:
project
)
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