Class: ClientperfResult

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
ClientperfDataBuilder
Defined in:
lib/clientperf_result.rb

Class Method Summary collapse

Methods included from ClientperfDataBuilder

build_data_for_chart, day_start_time, month_start_time

Class Method Details

.last_24_hoursObject



8
9
10
11
12
13
14
# File 'lib/clientperf_result.rb', line 8

def last_24_hours
  start_time = day_start_time
  results = average(:milliseconds, :conditions => ['created_at > ?', start_time], 
    :group => "date_format(created_at,'%Y-%m-%d %H')")

  build_data_for_chart(results, start_time, 23, :hours) 
end

.last_30_daysObject



16
17
18
19
20
21
22
# File 'lib/clientperf_result.rb', line 16

def last_30_days
  start_time = month_start_time
  results = average(:milliseconds, :conditions => ['created_at > ?', start_time], 
    :group => "date_format(created_at,'%Y-%m-%d')")

  build_data_for_chart(results, start_time, 29, :days)
end