diff options
author | Stan Hu <stanhu@gmail.com> | 2016-07-21 11:12:37 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-07-21 11:12:37 +0000 |
commit | 57e97a735ed3a5b9faf2d39bec460123623b2de6 (patch) | |
tree | c8e2078016d37295c5f91d8f729cacd074b2b38b | |
parent | 1459aa77bb998b838d8ad1c1abc73b1a69635357 (diff) | |
parent | 71a3336dc4f241e00c006a222397e62b039672ed (diff) | |
download | gitlab-ce-57e97a735ed3a5b9faf2d39bec460123623b2de6.tar.gz |
Merge branch '20055-build-duration-showing-too-many-digits' into 'master'
Cast duration to integer in `TimeHelper#time_interval_in_words`
Fixes #20055.
- [x] No CHANGELOG since it fixes a regression introduced in RC12.
- Tests
- [x] Added for this feature/bug
- [ ] All builds are passing
- [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 you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !5391
-rw-r--r-- | app/helpers/time_helper.rb | 1 | ||||
-rw-r--r-- | spec/helpers/time_helper_spec.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/app/helpers/time_helper.rb b/app/helpers/time_helper.rb index 1926f03af07..790001222f1 100644 --- a/app/helpers/time_helper.rb +++ b/app/helpers/time_helper.rb @@ -1,5 +1,6 @@ module TimeHelper def time_interval_in_words(interval_in_seconds) + interval_in_seconds = interval_in_seconds.to_i minutes = interval_in_seconds / 60 seconds = interval_in_seconds - minutes * 60 diff --git a/spec/helpers/time_helper_spec.rb b/spec/helpers/time_helper_spec.rb index 413ead944b9..bf3ed5c094c 100644 --- a/spec/helpers/time_helper_spec.rb +++ b/spec/helpers/time_helper_spec.rb @@ -5,6 +5,7 @@ describe TimeHelper do it "returns minutes and seconds" do intervals_in_words = { 100 => "1 minute 40 seconds", + 100.32 => "1 minute 40 seconds", 121 => "2 minutes 1 second", 3721 => "62 minutes 1 second", 0 => "0 seconds" |