Sha256: 20ecca384c28004122f2539c4b744e408e5f197d48061a54189f8e5c82f998f3

Contents?: true

Size: 800 Bytes

Versions: 12

Compression:

Stored size: 800 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)
          relation.where(query(date_string)).count
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hyrax-3.6.0 app/services/hyrax/statistics/users/over_time.rb
hyrax-4.0.0 app/services/hyrax/statistics/users/over_time.rb
hyrax-4.0.0.rc3 app/services/hyrax/statistics/users/over_time.rb
hyrax-4.0.0.rc2 app/services/hyrax/statistics/users/over_time.rb
hyrax-4.0.0.rc1 app/services/hyrax/statistics/users/over_time.rb
hyrax-3.5.0 app/services/hyrax/statistics/users/over_time.rb
hyrax-4.0.0.beta2 app/services/hyrax/statistics/users/over_time.rb
hyrax-3.4.2 app/services/hyrax/statistics/users/over_time.rb
hyrax-4.0.0.beta1 app/services/hyrax/statistics/users/over_time.rb
hyrax-3.4.1 app/services/hyrax/statistics/users/over_time.rb
hyrax-3.4.0 app/services/hyrax/statistics/users/over_time.rb
hyrax-3.3.0 app/services/hyrax/statistics/users/over_time.rb