Add elpased time.

This commit is contained in:
Rubén Dávila 2016-01-26 10:58:04 -05:00
parent 4e8266e8df
commit 1162f8d77e
3 changed files with 16 additions and 0 deletions

View file

@ -11,3 +11,7 @@ li.milestone {
height: 6px; height: 6px;
} }
} }
.time-elapsed {
color: #F14539;
}

View file

@ -110,6 +110,15 @@ class Milestone < ActiveRecord::Base
0 0
end 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 def expires_at
if due_date if due_date
if due_date.past? if due_date.past?

View file

@ -57,6 +57,9 @@
closed closed
%strong== #{@milestone.percent_complete}% %strong== #{@milestone.percent_complete}%
complete complete
%span.time-elapsed
%strong== #{@milestone.percent_time_used}%
time elapsed
%span.pull-right= @milestone.expires_at %span.pull-right= @milestone.expires_at
= milestone_progress_bar(@milestone) = milestone_progress_bar(@milestone)