Sha256: 24ae7c8bfd10540ac0b68d0b9ff2a51f7c48ee235c827857b26dd0b76ba281bf

Contents?: true

Size: 1.22 KB

Versions: 16

Compression:

Stored size: 1.22 KB

Contents

module Concen
  class TrafficsController < ApplicationController
    layout "concen/application"

    before_filter :authenticate_concen_user

    # Supports OS X and Linux, require top command.
    #   @current_month_visits = Statistic.visits_for_current :month
    # Real time visits
    # Historical statistics
    # Month: visits
    def show
      @page_title = "Traffic"
    end

    def visits_counts
      if @stats = Visit::Page.aggregate_count_by_time(:hour => params[:hour], :precision => "millisecond")
        # Readjust timestamp because flot graph doesn't handle time zone.
        @stats.map! do |s|
          time = Time.zone.at s[0]/1000
          [(time.utc.to_i + time.utc_offset)*1000, s[1]]
        end
      end
      respond_to do |format|
        format.json { render :json => @stats }
      end
    end

    def pages
      @pages_stats = Visit::Page.aggregate_count_by_url(:limit => 6)
      respond_to do |format|
        format.html { render :partial => "concen/traffics/pages" }
      end
    end

    def referrals
      @referrals_stats = Visit::Referral.aggregate_count_by_domain(:limit => 6)
      respond_to do |format|
        format.html { render :partial => "concen/traffics/referrals" }
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
concen-0.2.7 app/controllers/concen/traffics_controller.rb
concen-0.2.6 app/controllers/concen/traffics_controller.rb
concen-0.2.5 app/controllers/concen/traffics_controller.rb
concen-0.2.4 app/controllers/concen/traffics_controller.rb
concen-0.2.3 app/controllers/concen/traffics_controller.rb
concen-0.2.2 app/controllers/concen/traffics_controller.rb
concen-0.2.1 app/controllers/concen/traffics_controller.rb
concen-0.2.0 app/controllers/concen/traffics_controller.rb
concen-0.1.7 app/controllers/concen/traffics_controller.rb
concen-0.1.6 app/controllers/concen/traffics_controller.rb
concen-0.1.5 app/controllers/concen/traffics_controller.rb
concen-0.1.4 app/controllers/concen/traffics_controller.rb
concen-0.1.3 app/controllers/concen/traffics_controller.rb
concen-0.1.2 app/controllers/concen/traffics_controller.rb
concen-0.1.1 app/controllers/concen/traffics_controller.rb
concen-0.1 app/controllers/concen/traffics_controller.rb