2018-04-19 03:30:41 +08:00
|
|
|
class AdminDashboardNextData
|
|
|
|
include StatsCacheable
|
|
|
|
|
|
|
|
def initialize(opts = {})
|
|
|
|
@opts = opts
|
|
|
|
end
|
|
|
|
|
2018-07-20 02:33:11 +08:00
|
|
|
def self.fetch_stats
|
|
|
|
new.as_json
|
2018-06-21 05:15:11 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def get_json
|
2018-07-20 02:33:11 +08:00
|
|
|
{}
|
2018-04-19 03:30:41 +08:00
|
|
|
end
|
|
|
|
|
2018-07-20 02:33:11 +08:00
|
|
|
def as_json(_options = nil)
|
|
|
|
@json ||= get_json
|
2018-04-19 03:30:41 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.reports(source)
|
|
|
|
source.map { |type| Report.find(type).as_json }
|
|
|
|
end
|
2018-07-20 02:33:11 +08:00
|
|
|
|
|
|
|
def self.stats_cache_key
|
2018-08-01 05:35:13 +08:00
|
|
|
"dashboard-next-data-#{Report::SCHEMA_VERSION}"
|
2018-07-20 02:33:11 +08:00
|
|
|
end
|
2018-04-19 03:30:41 +08:00
|
|
|
end
|