diff options
author | James Lopez <james@gitlab.com> | 2016-11-22 20:33:07 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2016-11-22 20:33:07 +0300 |
commit | 4ba02169a64c98a1f5b56f5292945ae9f83d2644 (patch) | |
tree | f42032ef96fa7cb5c261b21c9ba38c9e18b8ad6c /app | |
parent | c4376b2f88ac3089719382aaf7385fc6907b369e (diff) | |
parent | ed85fa7b10ed2214c849b7d0d0b3164414afaa16 (diff) |
Merge branch 'fix/cycle-analytics-duration' into 'master'
fixed bug to do with calculating durations
Fixes a couple of small bugs while calculating durations in cycle analytics - probably due to some bad refactoring
- [ ] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added
- Tests
- [x] Added for this feature/bug
- [ ] 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)
## What are the relevant issue numbers?
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/24796
See merge request !7663
Diffstat (limited to 'app')
-rw-r--r-- | app/serializers/analytics_build_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/entity_date_helper.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/serializers/analytics_build_entity.rb b/app/serializers/analytics_build_entity.rb index 5fdf2bbf7c3..abefcd5cc02 100644 --- a/app/serializers/analytics_build_entity.rb +++ b/app/serializers/analytics_build_entity.rb @@ -13,7 +13,7 @@ class AnalyticsBuildEntity < Grape::Entity end expose :duration, as: :total_time do |build| - distance_of_time_as_hash(build[:duration].to_f) + distance_of_time_as_hash(build.duration.to_f) end expose :branch do diff --git a/app/serializers/entity_date_helper.rb b/app/serializers/entity_date_helper.rb index b333b3344c3..918abba8d99 100644 --- a/app/serializers/entity_date_helper.rb +++ b/app/serializers/entity_date_helper.rb @@ -2,7 +2,7 @@ module EntityDateHelper include ActionView::Helpers::DateHelper def interval_in_words(diff) - "#{distance_of_time_in_words(diff.to_f)} ago" + "#{distance_of_time_in_words(Time.now, diff)} ago" end # Converts seconds into a hash such as: |