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
71a3336d
Commit
71a3336d
authored
Jul 21, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cast duration to integer in `TimeHelper#time_interval_in_words`
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
479814b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
0 deletions
+2
-0
app/helpers/time_helper.rb
app/helpers/time_helper.rb
+1
-0
spec/helpers/time_helper_spec.rb
spec/helpers/time_helper_spec.rb
+1
-0
No files found.
app/helpers/time_helper.rb
View file @
71a3336d
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
...
...
spec/helpers/time_helper_spec.rb
View file @
71a3336d
...
@@ -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"
...
...
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