Sha256: 8fd353649ac6bfa73f874f1f0c9dbe08faad4f370784394334e4f1d91e19f2eb
Contents?: true
Size: 537 Bytes
Versions: 1
Compression:
Stored size: 537 Bytes
Contents
module Prosperity class Extractors::Group < Extractors::Base def key "group" end def to_a s = @metric.scope.where("#{metric.group_by} BETWEEN ? AND ?", @start_time, @end_time) s = s.group("to_char(#{metric.group_by}, '#{period.db_strf_str}')").count data = [] period.each_period(start_time, end_time) do |start_time| str = start_time.strftime(period.ruby_strf_str) value = s.has_key?(str) ? s[str].to_f : 0.0 data << value end data end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prosperity-0.0.1 | lib/prosperity/extractors/group.rb |