uc3-dmp-id 0.1.70 → 0.1.71

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccb63f060db6bbbf29aacb329a163adcb1c3ee80ecd9eed385894b5d3f824380
4
- data.tar.gz: 9caa229b0f0e270ac9da5160af0d1b36876cf95bbc5d4b9e2dc92a8a032c0406
3
+ metadata.gz: 06d836115caac7a07306686448df2e596b9d77f54368e4fb5f1e1f921e8c7ad6
4
+ data.tar.gz: afd13d10029262be80f08cc86516292567162bbd87679fe467b0dd23c1b5d72a
5
5
  SHA512:
6
- metadata.gz: ba8bfca2d71f74097386240b43888e1f4fbe2d0443a881f5a264b0db475f224bfc7e96f9592f61b108d82a9570d15613a7d5b098d4495319c6fc601e40d194e5
7
- data.tar.gz: e86673a1a825b4541ee868d5c7dac78d3cae186c328151c09e9ef6390bf687594ed36cd434d6f0ddd5a5b22cbd22c1627de0b5d6cbf465ca221f5c3b7b23d420
6
+ metadata.gz: aef2a4c77b3ee99d13f4aac02f544b978e5f7c84495e7fedcf0588f0ffa8efe495be8dc05e984487873620b292da3f9f1bf3e33a6119bbdce26c845df3161ac0
7
+ data.tar.gz: 87b47716904176310c6add2c3c7d376077ec462edfa6063b1f7f295b557c78ad4852e6bb3174a68c053b088ee1f8eefe2d43ea80f8d62ee10521fb0c83086a9c
@@ -207,21 +207,25 @@ module Uc3DmpId
207
207
  logger&.debug(message: 'Original HARVESTER_MODS record', details: resp)
208
208
  # The `dmphub_modifications` array will ONLY ever have things the harvester mods know about
209
209
  # so just find them and update the status accordingly
210
- mods = resp.dup
210
+ original = resp.dup
211
211
  json['dmphub_modifications'].each do |entry|
212
212
  next if entry.fetch('dmproadmap_related_identifiers', []).empty?
213
213
 
214
214
  entry['dmproadmap_related_identifiers'].each do |related|
215
- related_id = mods['related_works'][related.identifier] if related.respond_to?(:identifier)
216
- related_id = mods['related_works'][related['identifier']] if related_id.nil?
217
- next if related_id.nil?
218
-
219
- mods['related_works'][related_id]['status'] = related['status']
215
+ related_id = related.respond_to?(:identifier) ? related.identifier : related['identifier']
216
+ related_domain = related.respond_to?(:identifier) ? related.domain : related['domain']
217
+ key = "#{related_domain.end_with?('/') ? related_domain : "#{related_domain}/"}#{related_id}"
218
+ key_found = original['related_works'].has_key?(key)
219
+ logger&.debug(message: "No matching HARVEST_MOD found for #{key}") unless key_found
220
+ next unless key_found
221
+
222
+ logger&.debug(message: "Updating status for #{key} from #{original['related_works'][key]['status']} to #{related['status']}")
223
+ original['related_works'][key]['status'] = related['status']
220
224
  end
221
225
  end
222
226
 
223
- logger&.debug(message: 'Updating HARVESTER_MODS with:', details: mods)
224
- client.put_item(json: mods, logger:)
227
+ logger&.debug(message: 'Updating HARVESTER_MODS with:', details: original)
228
+ client.put_item(json: original, logger:)
225
229
  json.delete('dmphub_modifications')
226
230
  logger&.debug(message: 'After deleting dmphub_modifications:', details: json)
227
231
  json
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.70'
4
+ VERSION = '0.1.71'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.70
4
+ version: 0.1.71
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-11 00:00:00.000000000 Z
11
+ date: 2024-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json