discourse/app/models/admin_dashboard_next_general_data.rb
Joffrey JAFFEUX 7f2f3b8b22
FIX: improves reports resilience (#6239)
This commit makes most of the reports now lazy loaded, and making them benefits from graceful failures.
2018-08-06 16:57:40 -04:00

20 lines
374 B
Ruby

class AdminDashboardNextGeneralData < AdminDashboardNextData
def reports
@reports ||= %w{
users_by_type
users_by_trust_level
}
end
def get_json
{
reports: self.class.reports(reports).compact,
updated_at: Time.zone.now.as_json
}
end
def self.stats_cache_key
"general-dashboard-data-#{Report::SCHEMA_VERSION}"
end
end