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.3.3 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.3.2 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.3.1 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-1.1.1 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.3.0 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.0.3 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.2.4 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.2.3 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.2.2 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.2.1 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.2.0 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.1.0 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.1.0.rc4 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.1.0.rc3 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.1.0.rc2 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.1.0.rc1 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-1.1.0 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.1.0.beta2 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.0.2 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-2.1.0.beta1 app/presenters/hyrax/admin/repository_growth_presenter.rb