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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
03d58f56
Commit
03d58f56
authored
Mar 01, 2016
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Little refactor for milestone_remaining_days helper from last code review.
parent
77731802
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
app/helpers/milestones_helper.rb
app/helpers/milestones_helper.rb
+3
-4
app/models/milestone.rb
app/models/milestone.rb
+1
-2
No files found.
app/helpers/milestones_helper.rb
View file @
03d58f56
...
...
@@ -38,11 +38,10 @@ module MilestonesHelper
end
def
milestone_remaining_days
(
milestone
)
days
=
milestone
.
remaining_days
if
days
==
0
if
milestone
.
expired?
content_tag
(
:strong
,
'expired'
)
elsif
days
.
to_i
>
0
elsif
milestone
.
due_date
days
=
milestone
.
remaining_days
content
=
content_tag
(
:strong
,
days
)
content
<<
"
#{
'day'
.
pluralize
(
days
)
}
remaining"
end
...
...
app/models/milestone.rb
View file @
03d58f56
...
...
@@ -111,8 +111,7 @@ class Milestone < ActiveRecord::Base
end
def
remaining_days
return
nil
if
due_date
.
nil?
return
0
if
due_date
<
Date
.
today
return
0
if
!
due_date
||
expired?
(
due_date
-
Date
.
today
).
to_i
end
...
...
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