Add elpased time.
This commit is contained in:
parent
4e8266e8df
commit
1162f8d77e
|
@ -11,3 +11,7 @@ li.milestone {
|
|||
height: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.time-elapsed {
|
||||
color: #F14539;
|
||||
}
|
||||
|
|
|
@ -110,6 +110,15 @@ class Milestone < ActiveRecord::Base
|
|||
0
|
||||
end
|
||||
|
||||
def percent_time_used
|
||||
return 100 if expired?
|
||||
|
||||
duration = ((created_at - due_date.to_datetime) / 1.day)
|
||||
days_elapsed = ((created_at - Time.now) / 1.day)
|
||||
|
||||
((days_elapsed.to_f / duration) * 100).floor
|
||||
end
|
||||
|
||||
def expires_at
|
||||
if due_date
|
||||
if due_date.past?
|
||||
|
|
|
@ -57,6 +57,9 @@
|
|||
closed
|
||||
%strong== #{@milestone.percent_complete}%
|
||||
complete
|
||||
%span.time-elapsed
|
||||
%strong== #{@milestone.percent_time_used}%
|
||||
time elapsed
|
||||
%span.pull-right= @milestone.expires_at
|
||||
= milestone_progress_bar(@milestone)
|
||||
|
||||
|
|
Loading…
Reference in New Issue