Class: FilesystemUsage
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- FilesystemUsage
- Defined in:
- app/models/filesystem_usage.rb
Class Method Summary collapse
Class Method Details
.average_usage(start_time, group_by) ⇒ Object
4 5 6 7 8 9 |
# File 'app/models/filesystem_usage.rb', line 4 def self.average_usage(start_time, group_by) where(created_at: start_time..) .group_by_period(group_by, :created_at) .average(:used_percent) .transform_values { |value| value&.round(2) } end |