Sha256: ee3f2ef843787f8dcd926d59a3b76e60de26b47e72b18138ff5730bb46fff696
Contents?: true
Size: 926 Bytes
Versions: 6
Compression:
Stored size: 926 Bytes
Contents
# frozen_string_literal: true module Hyrax class TrophyPresenter include ModelProxy def initialize(solr_document) @solr_document = solr_document end attr_reader :solr_document delegate :to_s, :thumbnail_path, to: :solr_document # @param user [User] the user to find the TrophyPresentes for. # @return [Array<TrophyPresenter>] a list of all the trophy presenters for the user def self.find_by_user(user) work_ids = user.trophies.pluck(:work_id) query = Hyrax::SolrQueryBuilderService.construct_query_for_ids(work_ids) results = Hyrax::WorkRelation.new.search_with_conditions(query) results.map { |result| TrophyPresenter.new(document_model.new(result)) } rescue RSolr::Error::ConnectionRefused [] end def self.document_model CatalogController.blacklight_config.document_model end private_class_method :document_model end end
Version data entries
6 entries across 6 versions & 1 rubygems