Sha256: 42f2a04261ddd769dc72269323c47f4daf283fcfcacd8c7f29923a4f3754e685

Contents?: true

Size: 766 Bytes

Versions: 8

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true
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

8 entries across 8 versions & 1 rubygems

Version Path
hyrax-3.2.0 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-3.1.0 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-3.0.2 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-3.0.1 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-3.0.0 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-3.0.0.pre.rc4 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-3.0.0.pre.rc3 app/presenters/hyrax/admin/repository_growth_presenter.rb
hyrax-3.0.0.pre.rc2 app/presenters/hyrax/admin/repository_growth_presenter.rb