Method: Sufia::TrophyPresenter.find_by_user

Defined in:
app/presenters/sufia/trophy_presenter.rb

.find_by_user(user) ⇒ Object



12
13
14
15
16
17
18
19
# File 'app/presenters/sufia/trophy_presenter.rb', line 12

def self.find_by_user(user)
  work_ids = user.trophies.pluck(:work_id)
  query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids(work_ids)
  results = CurationConcerns::WorkRelation.new.search_with_conditions(query)
  results.map { |result| TrophyPresenter.new(document_model.new(result)) }
rescue RSolr::Error::ConnectionRefused
  []
end