Class: Admin::StatisticsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/statistics_controller.rb

Constant Summary collapse

DAYS_BACK =
21
WEEKS_BACK =
20
MONTHS_BACK =
24

Instance Method Summary collapse

Instance Method Details

#daysObject


9
10
11
12
13
14
# File 'app/controllers/admin/statistics_controller.rb', line 9

def days
  set_stats do
    Statistics.where("date > ?", time_units_back_timestamp(:days, DAYS_BACK))
  end
  render :action => "index"
end

#indexObject


4
5
6
# File 'app/controllers/admin/statistics_controller.rb', line 4

def index
  weeks
end

#monthsObject


25
26
27
28
29
30
# File 'app/controllers/admin/statistics_controller.rb', line 25

def months
  set_stats do
    Statistics.where("DAY(date) = 2 AND date > ?",time_units_back_timestamp(:months, MONTHS_BACK))
  end
  render :action => "index"
end

#weeksObject


17
18
19
20
21
22
# File 'app/controllers/admin/statistics_controller.rb', line 17

def weeks
  set_stats do
    Statistics.where("WEEKDAY(date) = 0 AND date > ?", time_units_back_timestamp(:weeks, WEEKS_BACK))
  end
  render :action => "index"
end