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
b938aa5c
Commit
b938aa5c
authored
Nov 23, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and relevant spec for plan stage breaking with nil commits
parent
b1b5060d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
1 deletion
+15
-1
changelogs/unreleased/fix-cycle-analytics-plan-issue.yml
changelogs/unreleased/fix-cycle-analytics-plan-issue.yml
+4
-0
lib/gitlab/cycle_analytics/base_event.rb
lib/gitlab/cycle_analytics/base_event.rb
+1
-1
lib/gitlab/cycle_analytics/plan_event.rb
lib/gitlab/cycle_analytics/plan_event.rb
+2
-0
spec/lib/gitlab/cycle_analytics/plan_event_spec.rb
spec/lib/gitlab/cycle_analytics/plan_event_spec.rb
+8
-0
No files found.
changelogs/unreleased/fix-cycle-analytics-plan-issue.yml
0 → 100644
View file @
b938aa5c
---
title
:
Fix cycle analytics plan stage when commits are missing
merge_request
:
author
:
lib/gitlab/cycle_analytics/base_event.rb
View file @
b938aa5c
...
@@ -16,7 +16,7 @@ module Gitlab
...
@@ -16,7 +16,7 @@ module Gitlab
event_result
.
map
do
|
event
|
event_result
.
map
do
|
event
|
serialize
(
event
)
if
has_permission?
(
event
[
'id'
])
serialize
(
event
)
if
has_permission?
(
event
[
'id'
])
end
end
.
compact
end
end
def
custom_query
(
_base_query
);
end
def
custom_query
(
_base_query
);
end
...
...
lib/gitlab/cycle_analytics/plan_event.rb
View file @
b938aa5c
...
@@ -27,6 +27,8 @@ module Gitlab
...
@@ -27,6 +27,8 @@ module Gitlab
end
end
def
first_time_reference_commit
(
commits
,
event
)
def
first_time_reference_commit
(
commits
,
event
)
return
nil
if
commits
.
blank?
YAML
.
load
(
commits
).
find
do
|
commit
|
YAML
.
load
(
commits
).
find
do
|
commit
|
next
unless
commit
[
:committed_date
]
&&
event
[
'first_mentioned_in_commit_at'
]
next
unless
commit
[
:committed_date
]
&&
event
[
'first_mentioned_in_commit_at'
]
...
...
spec/lib/gitlab/cycle_analytics/plan_event_spec.rb
View file @
b938aa5c
...
@@ -6,5 +6,13 @@ describe Gitlab::CycleAnalytics::PlanEvent do
...
@@ -6,5 +6,13 @@ describe Gitlab::CycleAnalytics::PlanEvent do
it
'has the default order'
do
it
'has the default order'
do
expect
(
event
.
order
).
to
eq
(
event
.
start_time_attrs
)
expect
(
event
.
order
).
to
eq
(
event
.
start_time_attrs
)
end
end
context
'no commits'
do
it
'does not blow up if there are no commits'
do
allow_any_instance_of
(
Gitlab
::
CycleAnalytics
::
EventsQuery
).
to
receive
(
:execute
).
and_return
([{}])
expect
{
event
.
fetch
}.
not_to
raise_error
end
end
end
end
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