Sha256: ee41968b7199fd4d577bb6c08565491ae21551ebde67194c62293617c69914fd

Contents?: true

Size: 670 Bytes

Versions: 57

Compression:

Stored size: 670 Bytes

Contents

module Hyrax
  module Admin
    class UserActivityPresenter
      def initialize
        @x_min = 90.days.ago.beginning_of_day
        @date_format = ->(x) { x.strftime('%b %-d') }
      end

      def as_json(*)
        new_users.to_a.zip(returning_users.to_a).map do |e|
          { y: e.first.first, a: e.first.last, b: e.last.try(:last) }
        end
      end

      private

        def new_users
          Hyrax::Statistics::Users::OverTime.new(x_min: @x_min,
                                                 x_output: @date_format).points
        end

        # TODO: using google analytics
        def returning_users
          []
        end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.9.5 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.9.4 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.9.3 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.9.2 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.9.1 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.9.0 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.8.0 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.7.2 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.7.1 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.7.0 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.6.0 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-3.0.0.pre.rc1 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-3.0.0.pre.beta3 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.5.1 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.5.0 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-3.0.0.pre.beta2 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.4.1 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-3.0.0.pre.beta1 app/presenters/hyrax/admin/user_activity_presenter.rb
hyrax-2.4.0 app/presenters/hyrax/admin/user_activity_presenter.rb