Class: Trackguard::Admin::DashboardsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/trackguard/admin/dashboards_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/trackguard/admin/dashboards_controller.rb', line 4

def show
  @total_today  = PageView.today.count
  @total_week   = PageView.this_week.count
  @total_month  = PageView.this_month.count

  @top_pages     = PageView.last_30.group(:path).order("count_all DESC").limit(5).count
  @top_referrers = PageView.last_30.with_referrer.group(:referer).order("count_all DESC").limit(5).count
  @top_sources   = PageView.last_30.with_source.group(:source).order("count_all DESC").limit(5).count

  @recent = PageView.order(created_at: :desc).limit(20).includes(visitor: :whitelisted_ip)
end