Class: Sincerely::DashboardController

Inherits:
ApplicationController show all
Includes:
Concerns::DeliveryMetrics, Concerns::NotificationTimeline, Concerns::Periods
Defined in:
app/controllers/sincerely/dashboard_controller.rb

Instance Method Summary collapse

Instance Method Details

#index ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/sincerely/dashboard_controller.rb', line 9

def index
  @total_notifications = filtered_notifications.count
  @notifications_by_state = filtered_notifications.group(:delivery_state).count
  @recent_notifications = filtered_notifications.order(created_at: :desc).limit(10)
  @delivery_rate = calculate_delivery_rate
  @open_rate = calculate_open_rate
  @bounce_rate = calculate_bounce_rate
  @recent_delivery_events = recent_delivery_events
  @recent_engagement_events = recent_engagement_events
  @notifications_by_message_id = preload_notifications_for_events
  @current_period = current_period
  @notifications_timeline = build_timeline_data(filtered_notifications)
end