Commit 3ea982fc authored by Stan Hu's avatar Stan Hu Committed by Rémy Coutable

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
parent 478116f0
module TimeHelper module TimeHelper
def time_interval_in_words(interval_in_seconds) def time_interval_in_words(interval_in_seconds)
interval_in_seconds = interval_in_seconds.to_i
minutes = interval_in_seconds / 60 minutes = interval_in_seconds / 60
seconds = interval_in_seconds - minutes * 60 seconds = interval_in_seconds - minutes * 60
......
...@@ -5,6 +5,7 @@ describe TimeHelper do ...@@ -5,6 +5,7 @@ describe TimeHelper do
it "returns minutes and seconds" do it "returns minutes and seconds" do
intervals_in_words = { intervals_in_words = {
100 => "1 minute 40 seconds", 100 => "1 minute 40 seconds",
100.32 => "1 minute 40 seconds",
121 => "2 minutes 1 second", 121 => "2 minutes 1 second",
3721 => "62 minutes 1 second", 3721 => "62 minutes 1 second",
0 => "0 seconds" 0 => "0 seconds"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment