Class: ClientperfUri

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ClientperfDataBuilder
Defined in:
lib/clientperf_uri.rb

Instance Method Summary collapse

Methods included from ClientperfDataBuilder

#build_data_for_chart, #day_start_time, #month_start_time

Instance Method Details

#last_24_hoursObject



5
6
7
8
9
10
11
# File 'lib/clientperf_uri.rb', line 5

def last_24_hours
  start_time = day_start_time
  results = clientperf_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



13
14
15
16
17
18
19
# File 'lib/clientperf_uri.rb', line 13

def last_30_days
  start_time = month_start_time
  results = clientperf_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