diff --git a/app/models/application_request.rb b/app/models/application_request.rb index a178a0cf480..b0e0df278ae 100644 --- a/app/models/application_request.rb +++ b/app/models/application_request.rb @@ -15,7 +15,7 @@ class ApplicationRequest < ActiveRecord::Base # auto flush if older than this self.autoflush_seconds = 5.minutes - self.last_flush = Time.now + self.last_flush = Time.now.utc def self.increment!(type, opts=nil) key = redis_key(type) @@ -28,7 +28,7 @@ class ApplicationRequest < ActiveRecord::Base return end - if (Time.now - last_flush).to_i > autoflush_seconds + if (Time.now.utc - last_flush).to_i > autoflush_seconds write_cache! end end @@ -40,7 +40,7 @@ class ApplicationRequest < ActiveRecord::Base return end - self.last_flush = Time.now + self.last_flush = Time.now.utc date = date.to_date diff --git a/app/models/report.rb b/app/models/report.rb index 03092648e49..3cc9f1c101a 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -13,8 +13,8 @@ class Report @data = nil @total = nil @prev30Days = nil - @start_date ||= 1.month.ago.utc.beginning_of_day - @end_date ||= Time.now.utc.end_of_day + @start_date ||= 1.month.ago.beginning_of_day + @end_date ||= Time.zone.now.end_of_day end def as_json(options = nil)