Sha256: 2c7a3371fd806e2a7cf1f299722b0ddf569e19c5b2aa44234f8fec37bdac14e3
Contents?: true
Size: 1.16 KB
Versions: 57
Compression:
Stored size: 1.16 KB
Contents
module Hyrax module Admin class RepositoryObjectPresenter include Blacklight::SearchHelper def as_json(*) counts.map do |k, v| { label: I18n.translate(k, scope: 'hyrax.admin.stats.repository_objects.series'), value: v } end end private delegate :blacklight_config, to: CatalogController def counts translation = { 'false' => :published, 'true' => :unpublished, nil => :unknown } raw_count = Hash[*results.to_a.flatten] @counts ||= raw_count.each_with_object({}) { |(k, v), o| o[translation[k]] = v } end def search_builder Stats::WorkStatusSearchBuilder.new(self) end # results come from Solr in an array where the first item is the status and # the second item is the count # @example # [ "true", 55, "false", 205, nil, 11 ] # @return [#each] an enumerable object of tuples (status and count) def results facet_results = repository.search(search_builder) facet_results.facet_fields[IndexesWorkflow.suppressed_field].each_slice(2) end end end end
Version data entries
57 entries across 57 versions & 1 rubygems