mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-28 04:48:49 +01:00
Provide the number of days that the todo was stale instead of a class name to use in the view. We'll use the number of days stale in the helper to determine the class name
10 lines
234 B
Ruby
10 lines
234 B
Ruby
require 'active_support/all'
|
|
|
|
class Staleness
|
|
SECONDS_PER_DAY = 86400
|
|
def self.days_stale(item, current_user)
|
|
return 0 if item.due || item.completed?
|
|
(current_user.time - item.created_at).to_i / SECONDS_PER_DAY
|
|
end
|
|
end
|
|
|