mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 21:41:03 +08:00
FIX: dashboard report date range calculations include time zone, and application request data too
This commit is contained in:
@ -15,7 +15,7 @@ class ApplicationRequest < ActiveRecord::Base
|
|||||||
|
|
||||||
# auto flush if older than this
|
# auto flush if older than this
|
||||||
self.autoflush_seconds = 5.minutes
|
self.autoflush_seconds = 5.minutes
|
||||||
self.last_flush = Time.now
|
self.last_flush = Time.now.utc
|
||||||
|
|
||||||
def self.increment!(type, opts=nil)
|
def self.increment!(type, opts=nil)
|
||||||
key = redis_key(type)
|
key = redis_key(type)
|
||||||
@ -28,7 +28,7 @@ class ApplicationRequest < ActiveRecord::Base
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if (Time.now - last_flush).to_i > autoflush_seconds
|
if (Time.now.utc - last_flush).to_i > autoflush_seconds
|
||||||
write_cache!
|
write_cache!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -40,7 +40,7 @@ class ApplicationRequest < ActiveRecord::Base
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.last_flush = Time.now
|
self.last_flush = Time.now.utc
|
||||||
|
|
||||||
date = date.to_date
|
date = date.to_date
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ class Report
|
|||||||
@data = nil
|
@data = nil
|
||||||
@total = nil
|
@total = nil
|
||||||
@prev30Days = nil
|
@prev30Days = nil
|
||||||
@start_date ||= 1.month.ago.utc.beginning_of_day
|
@start_date ||= 1.month.ago.beginning_of_day
|
||||||
@end_date ||= Time.now.utc.end_of_day
|
@end_date ||= Time.zone.now.end_of_day
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_json(options = nil)
|
def as_json(options = nil)
|
||||||
|
Reference in New Issue
Block a user