diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-11-23 13:13:29 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-11-23 13:13:29 +0300 |
commit | db02af3e2496203890c9ab1aa5a17eb891071682 (patch) | |
tree | 4116bb60b828d4ec543332e09f5f1225a5c98e50 /lib | |
parent | 9f7fc6a0434399170ce1b089a6b00e11d0880f16 (diff) | |
parent | b938aa5cc83ffb51b516c7abfaaf6fe5e37031a6 (diff) |
Merge branch 'fix/cycle-analytics-plan-issue' into 'master'
Fix cycle analytics plan stage when commits are missing
Takes into account when commits are `nil` so the app doesn't throw an exception and also removes them.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/24836
- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added
- Tests
- [x] Added for this feature/bug
- [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !7694
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/cycle_analytics/base_event.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/cycle_analytics/plan_event.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/cycle_analytics/base_event.rb b/lib/gitlab/cycle_analytics/base_event.rb index 486139b1687..53a148ad703 100644 --- a/lib/gitlab/cycle_analytics/base_event.rb +++ b/lib/gitlab/cycle_analytics/base_event.rb @@ -16,7 +16,7 @@ module Gitlab event_result.map do |event| serialize(event) if has_permission?(event['id']) - end + end.compact end def custom_query(_base_query); end diff --git a/lib/gitlab/cycle_analytics/plan_event.rb b/lib/gitlab/cycle_analytics/plan_event.rb index b1ae215f348..7c3f0e9989f 100644 --- a/lib/gitlab/cycle_analytics/plan_event.rb +++ b/lib/gitlab/cycle_analytics/plan_event.rb @@ -27,6 +27,8 @@ module Gitlab end def first_time_reference_commit(commits, event) + return nil if commits.blank? + YAML.load(commits).find do |commit| next unless commit[:committed_date] && event['first_mentioned_in_commit_at'] |