uc3-dmp-id 0.1.69 → 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: c4355f81f314520bd52003c27e4593e670322a0efe7d400e647edb4dac10dfd3
4
- data.tar.gz: af81b71d4a6a1ad0c415afc7f2b7f69e916feab5e9cdbf99079ffc9e30cc1397
3
+ metadata.gz: 06d836115caac7a07306686448df2e596b9d77f54368e4fb5f1e1f921e8c7ad6
4
+ data.tar.gz: afd13d10029262be80f08cc86516292567162bbd87679fe467b0dd23c1b5d72a
5
5
  SHA512:
6
- metadata.gz: ced1e2298a918308e0948326645ffdfeb0519c07d611dfd8909f70138bbf32a485926d9b1752b9fe556a71466bca2b8cc44f25e904891559ca929f69aeaf2483
7
- data.tar.gz: c96ddbefb0409be5da359ef0158efa3d876fd2f28856c6bc4a12b9591651013b1a13f478af454129497f1e86515274bcad5f60da89fd7b0824b60196d5b65974
6
+ metadata.gz: aef2a4c77b3ee99d13f4aac02f544b978e5f7c84495e7fedcf0588f0ffa8efe495be8dc05e984487873620b292da3f9f1bf3e33a6119bbdce26c845df3161ac0
7
+ data.tar.gz: 87b47716904176310c6add2c3c7d376077ec462edfa6063b1f7f295b557c78ad4852e6bb3174a68c053b088ee1f8eefe2d43ea80f8d62ee10521fb0c83086a9c
@@ -51,7 +51,7 @@ module Uc3DmpId
51
51
 
52
52
  # Splice the assertions
53
53
  version = _process_modifications(owner:, updater:, version:, mods:, logger:)
54
- logger&.debug(message: 'Mods after process_modifications', details: mods)
54
+ logger&.debug(message: 'Mods after process_modifications', details: version)
55
55
 
56
56
  # Set the :modified timestamps
57
57
  now = Time.now.utc
@@ -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.69'
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.69
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