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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
8aac79be
Commit
8aac79be
authored
Jul 10, 2018
by
Marcel Amirault
Committed by
Rémy Coutable
Jul 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update time_helper.rb to fix output for exact minutes.
parent
7407efe1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
app/helpers/time_helper.rb
app/helpers/time_helper.rb
+6
-2
spec/helpers/time_helper_spec.rb
spec/helpers/time_helper_spec.rb
+6
-4
No files found.
app/helpers/time_helper.rb
View file @
8aac79be
...
@@ -5,9 +5,13 @@ module TimeHelper
...
@@ -5,9 +5,13 @@ module TimeHelper
seconds
=
interval_in_seconds
-
minutes
*
60
seconds
=
interval_in_seconds
-
minutes
*
60
if
minutes
>=
1
if
minutes
>=
1
"
#{
pluralize
(
minutes
,
"minute"
)
}
#{
pluralize
(
seconds
,
"second"
)
}
"
if
seconds
%
60
==
0
pluralize
(
minutes
,
"minute"
)
else
else
"
#{
pluralize
(
seconds
,
"second"
)
}
"
[
pluralize
(
minutes
,
"minute"
),
pluralize
(
seconds
,
"second"
)].
to_sentence
end
else
pluralize
(
seconds
,
"second"
)
end
end
end
end
...
...
spec/helpers/time_helper_spec.rb
View file @
8aac79be
...
@@ -4,10 +4,12 @@ describe TimeHelper do
...
@@ -4,10 +4,12 @@ describe TimeHelper do
describe
"#time_interval_in_words"
do
describe
"#time_interval_in_words"
do
it
"returns minutes and seconds"
do
it
"returns minutes and seconds"
do
intervals_in_words
=
{
intervals_in_words
=
{
100
=>
"1 minute 40 seconds"
,
60
=>
"1 minute"
,
100.32
=>
"1 minute 40 seconds"
,
100
=>
"1 minute and 40 seconds"
,
121
=>
"2 minutes 1 second"
,
100.32
=>
"1 minute and 40 seconds"
,
3721
=>
"62 minutes 1 second"
,
120
=>
"2 minutes"
,
121
=>
"2 minutes and 1 second"
,
3721
=>
"62 minutes and 1 second"
,
0
=>
"0 seconds"
0
=>
"0 seconds"
}
}
...
...
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