mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-02 19:10:16 +01:00
Purge UserTime from app/*
This commit is contained in:
parent
7a3f90a020
commit
622291d98d
7 changed files with 10 additions and 12 deletions
|
|
@ -15,13 +15,13 @@ class Preference < ActiveRecord::Base
|
|||
date = nil
|
||||
|
||||
if s.is_a?(Time)
|
||||
date = s.in_time_zone(time_zone).to_date
|
||||
date = s.to_date
|
||||
elsif s.is_a?(String)
|
||||
date = Date.strptime(s, date_format)
|
||||
else
|
||||
raise ArgumentError.new("Bad argument type:#{s.class}")
|
||||
end
|
||||
|
||||
UserTime.new(user).midnight(date)
|
||||
date.in_time_zone(time_zone).beginning_of_day
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -101,9 +101,8 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def needs_review?(user)
|
||||
current_time = UserTime.new(user).time
|
||||
return active? && ( last_reviewed.nil? ||
|
||||
(last_reviewed < current_time - user.prefs.review_period.days))
|
||||
(last_reviewed < Time.current - user.prefs.review_period.days))
|
||||
end
|
||||
|
||||
def blocked?
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ class Todo < ActiveRecord::Base
|
|||
activate
|
||||
else
|
||||
# parse Date objects into the proper timezone
|
||||
date = UserTime.new(user).midnight(date) if (date.is_a? Date)
|
||||
date = date.in_time_zone.beginning_of_day if (date.is_a? Date)
|
||||
|
||||
# show_from needs to be set before state_change because of "bug" in aasm.
|
||||
# If show_from is not set, the todo will not validate and thus aasm will not save
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class User < ActiveRecord::Base
|
|||
order('show_from ASC, todos.created_at DESC')},
|
||||
:class_name => 'Todo') do
|
||||
def find_and_activate_ready
|
||||
where('show_from <= ?', Time.zone.now).collect { |t| t.activate! }
|
||||
where('show_from <= ?', Time.current).collect { |t| t.activate! }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def date
|
||||
UserTime.new(self).midnight(Time.now)
|
||||
Date.current
|
||||
end
|
||||
|
||||
def generate_token
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue