Sha256: 4814f4d2ca338a9051d932ffd1bd667dccbcca8850cf9ff1347d814660c7c44f

Contents?: true

Size: 659 Bytes

Versions: 4

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true
module Zizia
  class PreIngestWork < ::ApplicationRecord
    has_many :pre_ingest_files

    # Returns the title based on the deduplication_key if the work has been indexed to solr
    # @return [String] the work's title
    def title
      return 'This work does not have a deduplication key.' if deduplication_key.nil?
      solr_title = ActiveFedora::SolrService.get("deduplication_key_tesim:#{deduplication_key}")
                                            .dig('response', 'docs', 0, 'title_tesim', 0)
      return solr_title unless solr_title.nil?
      'This work\'s metadata has not been indexed yet.'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zizia-6.0.1 app/models/zizia/pre_ingest_work.rb
zizia-6.0.0 app/models/zizia/pre_ingest_work.rb
zizia-5.3.0 app/models/zizia/pre_ingest_work.rb
zizia-5.2.0 app/models/zizia/pre_ingest_work.rb