mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:40:00 +08:00
FIX: dashboard report date range calculations include time zone, and application request data too
This commit is contained in:
parent
07af79c85b
commit
96b15cbba6
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user