Class: RailsErrorDashboard::Queries::DashboardStats
- Inherits:
-
Object
- Object
- RailsErrorDashboard::Queries::DashboardStats
- Defined in:
- lib/rails_error_dashboard/queries/dashboard_stats.rb
Overview
Query: Fetch dashboard statistics This is a read operation that aggregates error data for the dashboard
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call ⇒ Object
8 9 10 |
# File 'lib/rails_error_dashboard/queries/dashboard_stats.rb', line 8 def self.call new.call end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rails_error_dashboard/queries/dashboard_stats.rb', line 12 def call { total_today: ErrorLog.where("occurred_at >= ?", Time.current.beginning_of_day).count, total_week: ErrorLog.where("occurred_at >= ?", 7.days.ago).count, total_month: ErrorLog.where("occurred_at >= ?", 30.days.ago).count, unresolved: ErrorLog.unresolved.count, resolved: ErrorLog.resolved.count, by_environment: ErrorLog.group(:environment).count, by_platform: ErrorLog.group(:platform).count, top_errors: top_errors } end |