Purge UserTime from app/*

This commit is contained in:
Dan Rice 2014-06-12 21:24:31 -04:00
parent 7a3f90a020
commit 622291d98d
7 changed files with 10 additions and 12 deletions

View file

@ -29,7 +29,7 @@ module ApplicationHelper
end
def days_from_today(date)
(date.in_time_zone.to_date - UserTime.new(current_user).date).to_i
(date.in_time_zone.to_date - Date.current).to_i
end
# Check due date in comparison to today's date Flag up date appropriately with

View file

@ -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

View file

@ -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?

View file

@ -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

View file

@ -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

View file

@ -30,7 +30,7 @@
<div id="recurring_timespan">
<br/>
<label for="recurring_todo[start_from]"><%= t('todos.recurrence.starts_on') %>:</label><%=
text_field(:recurring_todo, :start_from, "value" => format_date(UserTime.new(current_user).time), "size" => 12, "class" => "Date", "autocomplete" => "off") %><br/>
text_field(:recurring_todo, :start_from, "value" => format_date(Date.current), "size" => 12, "class" => "Date", "autocomplete" => "off") %><br/>
<br/>
<label for="recurring_todo[ends_on]"><%= t('todos.recurrence.ends_on') %>:</label><br/>
<%= radio_button_tag('recurring_todo[ends_on]', 'no_end_date', true)%> <%= t('todos.recurrence.no_end_date') %><br/>

View file

@ -3,7 +3,6 @@
<span class="errors">
<%= get_list_of_error_messages_for(@todo) if @todo %>
</span>
<% this_year = UserTime.new(current_user).date.strftime("%Y").to_i -%>
<h2><label for="todo_description"><%= t('common.description') %></label></h2>
<%= text_field( "todo", "description", "tabindex" => 1, "maxlength" => 100, "size" => 50) %>
<h2><label for="tag_list"><%= t('todos.tags') %></label></h2>
@ -32,7 +31,7 @@ end %>
<%= text_area( "todo", "notes", "cols" => 40, "rows" => 3, "tabindex" => 5) %>
<h2><label for="todo_due"><%= t('todos.due') %></label></h2>
<%= date_select("todo", "due", {:order => [:day, :month, :year],
:start_year => this_year, :include_blank => '--'}, :tabindex => 6) %>
:start_year => Date.current.year, :include_blank => '--'}, :tabindex => 6) %>
<h2><label for="todo_show_from"><%= t('todos.show_from') %></label></h2>
<%= date_select("todo", "show_from", {:order => [:day, :month, :year],
:start_year => this_year, :include_blank => true}, :tabindex => 7) %>
:start_year => Date.current.year, :include_blank => true}, :tabindex => 7) %>