Sha256: bffbf097a4c0b00b8c0b8ffde89996b96796ce140084ccc8b2798519c3ff2f08

Contents?: true

Size: 752 Bytes

Versions: 57

Compression:

Stored size: 752 Bytes

Contents

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

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

      private

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

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

Version data entries

57 entries across 57 versions & 1 rubygems

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