Skip to content

Commit

Permalink
Merge pull request #161 from the-codetrane/v1-aardvark
Browse files Browse the repository at this point in the history
GBL --> Aardvark Migrator Refactors
  • Loading branch information
thatbudakguy committed Aug 7, 2023
2 parents f30e6d1 + dec4595 commit e3e9f91
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/geo_combine/migrators/v1_aardvark_migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ def convert_single_to_multi_valued_fields
def convert_non_crosswalked_fields
# Keys may or may not include whitespace, so we normalize them.
# Resource class is required so we default to "Other"; resource type is not required.
@v2_hash['gbl_resourceClass_s'] = RESOURCE_CLASS_MAP[@v1_hash['dc_type_s'].gsub(/\s+/, '')] || ['Other']
resource_type = RESOURCE_TYPE_MAP[@v1_hash['layer_geom_type_s'].gsub(/\s+/, '')]
@v2_hash['gbl_resourceClass_s'] = RESOURCE_CLASS_MAP[@v1_hash['dc_type_s']&.gsub(/\s+/, '')] || ['Other']
resource_type = RESOURCE_TYPE_MAP[@v1_hash['layer_geom_type_s']&.gsub(/\s+/, '')]
@v2_hash['gbl_resourceType_s'] = resource_type unless resource_type.nil?

# If the user specified a collection id map, use it to convert the collection names to ids
is_part_of = @v1_hash['dct_isPartOf_sm']&.map { |name| @collection_id_map[name] }&.compact
if is_part_of.empty?
@v2_hash.delete('dct_isPartOf_sm')
else
if is_part_of.present?
@v2_hash['dct_isPartOf_sm'] = is_part_of
else
@v2_hash.delete('dct_isPartOf_sm')
end
end

Expand Down

0 comments on commit e3e9f91

Please sign in to comment.