Sha256: 28661ea8cdf86ad7129b5f70a99776899a762faec0a8264d771689e929846be5

Contents?: true

Size: 1.02 KB

Versions: 29

Compression:

Stored size: 1.02 KB

Contents

module Uva
  module ModsIndexMethods
  # extracts the last_name##full_name##computing_id to be used by home view
  def extract_person_full_names_and_computing_ids
    names = {}
    self.find_by_terms(:person).each do |person|
      name_parts = person.children.inject({}) do |hash,child|
        hash[child.get_attribute(:type)] = child.text if ["family","given"].include? child.get_attribute(:type)
        hash["computing_id"] = child.text if child.name == 'computing_id'
        hash
      end
      if name_parts.length == 3 and person.search(:roleTerm).children.text.include?("Author")
        if name_parts["family"].blank? && name_parts["given"].blank? && name_parts["computing_id"].blank?
          value = "Unknown Author"
        else
          value = "#{name_parts["family"]}, #{name_parts["given"]} (#{name_parts["computing_id"]})"
        end
        ::Solrizer::Extractor.insert_solr_field_value(names, "person_full_name_cid_facet", value) if name_parts.length == 3        
      end      
    end
    names
  end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
hydra-head-4.0.0.rc2 lib/uva/mods_index_methods.rb
hydra-head-3.3.0 lib/uva/mods_index_methods.rb
hydra-head-3.2.2 lib/uva/mods_index_methods.rb
hydra-head-3.2.1 lib/uva/mods_index_methods.rb
hydra-head-3.2.0 lib/uva/mods_index_methods.rb
hydra-head-3.2.0.pre3 lib/uva/mods_index_methods.rb
hydra-head-3.2.0.pre2 lib/uva/mods_index_methods.rb
hydra-head-3.2.0.pre1 lib/uva/mods_index_methods.rb
hydra-head-3.1.5 lib/uva/mods_index_methods.rb
hydra-head-3.1.4 lib/uva/mods_index_methods.rb
hydra-head-3.1.3 lib/uva/mods_index_methods.rb
hydra-head-3.1.2 lib/uva/mods_index_methods.rb
hydra-head-3.1.1 lib/uva/mods_index_methods.rb
hydra-head-3.1.0 lib/uva/mods_index_methods.rb
hydra-head-3.1.0.rc2 lib/uva/mods_index_methods.rb
hydra-head-3.1.0.rc1 lib/uva/mods_index_methods.rb
hydra-head-3.1.0.pre5 lib/uva/mods_index_methods.rb
hydra-head-3.1.0.pre4 lib/uva/mods_index_methods.rb
hydra-head-3.1.0.pre3 lib/uva/mods_index_methods.rb
hydra-head-3.0.1 lib/uva/mods_index_methods.rb