Sha256: fbb14227a77c806604832a7bdea3e4ad47c2f5de5e2c9425ca1c76661eae71fa
Contents?: true
Size: 953 Bytes
Versions: 6
Compression:
Stored size: 953 Bytes
Contents
# frozen_string_literal: true module Hyrax module Statistics module Users class OverTime < Statistics::OverTime # Overridden to do a noncumulative query def points Enumerator.new(size) do |y| x = @x_min while x <= @x_max y.yield [@x_output.call(x), point(x)] x += @delta_x.days end end end private def relation ::User.registered end # Overridden to search one day at a time def query(date_string) { created_at: date_string.to_date.beginning_of_day..date_string.to_date.end_of_day } end def point(date_string) # convert the User::ActiveRecord_Relation to an array so that ".size" returns a number, # instead of a hash of { user_id: size } relation.where(query(date_string)).to_a.size end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems