Class: RailsPulse::Summary
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- RailsPulse::Summary
- Defined in:
- app/models/rails_pulse/summary.rb
Constant Summary collapse
- PERIOD_TYPES =
%w[hour day week month].freeze
Class Method Summary collapse
- .calculate_period_end(period_type, start_time) ⇒ Object
- .normalize_period_start(period_type, time) ⇒ Object
- .ransackable_associations(auth_object = nil) ⇒ Object
-
.ransackable_attributes(auth_object = nil) ⇒ Object
Ransack configuration.
Class Method Details
.calculate_period_end(period_type, start_time) ⇒ Object
179 180 181 182 183 184 185 186 |
# File 'app/models/rails_pulse/summary.rb', line 179 def calculate_period_end(period_type, start_time) case period_type when "hour" then start_time.end_of_hour when "day" then start_time.end_of_day when "week" then start_time.end_of_week when "month" then start_time.end_of_month end end |
.normalize_period_start(period_type, time) ⇒ Object
188 189 190 191 192 193 194 195 |
# File 'app/models/rails_pulse/summary.rb', line 188 def normalize_period_start(period_type, time) case period_type when "hour" then time.beginning_of_hour when "day" then time.beginning_of_day when "week" then time.beginning_of_week when "month" then time.beginning_of_month end end |
.ransackable_associations(auth_object = nil) ⇒ Object
101 102 103 |
# File 'app/models/rails_pulse/summary.rb', line 101 def self.ransackable_associations(auth_object = nil) %w[route query] end |
.ransackable_attributes(auth_object = nil) ⇒ Object
Ransack configuration
92 93 94 95 96 97 98 99 |
# File 'app/models/rails_pulse/summary.rb', line 92 def self.ransackable_attributes(auth_object = nil) %w[ period_start period_end avg_duration min_duration max_duration count error_count requests_per_minute error_rate_percentage route_path_cont execution_count total_time_consumed normalized_sql summarizable_id summarizable_type ] end |