Class: ActiveAnalytics::SitesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/active_analytics/sites_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
# File 'app/controllers/active_analytics/sites_controller.rb', line 7

def index
  @sites = ViewsPerDay.after(30.days.ago).order_by_totals.group_by_site
  redirect_to(site_path(@sites.first.host)) if @sites.size == 1
end

#showObject



12
13
14
15
16
17
# File 'app/controllers/active_analytics/sites_controller.rb', line 12

def show
  scope = current_views_per_days
  @histogram = ViewsPerDay::Histogram.new(scope.order_by_date.group_by_date, params[:from], params[:to])
  @referrers = scope.top.group_by_referrer_site
  @pages = scope.top.group_by_page
end