uc3-dmp-id 0.0.100 → 0.0.102

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: 980cf55dcebe87df7656894c5322def896fc16863fc8e1bb4d5a2c3f44c289df
4
- data.tar.gz: 94dd8f43a9dc1108fe030f6651ea858f3445d6f27a42ba7f448fe4c311b180cd
3
+ metadata.gz: 259cd78bdceb8b572adafe27bf79e17a797d94e306d92cbfbaeaf4595f63f714
4
+ data.tar.gz: 4e33a878cdb28d1d40f12f34c36e62dbd7da6e40eb7e06d39564da20d621e052
5
5
  SHA512:
6
- metadata.gz: 1c54010fb9da4a20dd0604f7a88105aa79cb7129f8167abee1fd61d8bd1ea5a0186e721eab95cc46d71b227bd7faf8f98174bc91813f5cfac5a052cdb7956f75
7
- data.tar.gz: 7033cdaf7cddb6dcfe307fd33117e472fe69068d23b34b545cca023452382da953c73ed7f4c525e3ff7e07400d3df0eaeeafb3db3742f98a2941877d6ca80df6
6
+ metadata.gz: 779fbbf1623506a0a0cfef7c85a3a9d0e3297cc015ef2de38f06e36fd93a501fd4a6ebfc499dc615fb8242471183c6526b74fba18de39ed10af7fe95b35b92f1
7
+ data.tar.gz: 9a890097d0cab40a0eab7d752b2eca9893e7a473dfd9359b0a1161e67bb4be48f178ba55bbec1b3f2b4cd14f12926621d71c0706313bef1fa5f849812d010103
@@ -7,6 +7,9 @@ module Uc3DmpId
7
7
  class << self
8
8
  # Add assertions to a DMP ID - this is performed by non-provenance systems
9
9
  def add(updater:, dmp:, mods:, note: nil, logger: nil)
10
+
11
+ puts "ADDING ASSERTIONS: #{mods}"
12
+
10
13
  # If the updater and provenance are the same just return the :dmp as-is
11
14
  return dmp if updater.nil? || !dmp.is_a?(Hash) || !mods.is_a?(Hash) ||
12
15
  updater&.gsub('PROVENANCE#', '') == dmp['dmphub_provenance_id']&.gsub('PROVENANCE#', '')
@@ -29,15 +32,16 @@ module Uc3DmpId
29
32
 
30
33
  # Splice together assertions made while the user was updating the DMP ID
31
34
  def splice(latest_version:, modified_version:, logger: nil)
35
+
36
+ puts "LATEST_VERSION ASSERTIONS: #{latest_version['dmphub_assertions']}"
37
+ puts "MODIFIED_VERSION ASSERTIONS: #{modified_version['dmphub_assertions']}"
38
+
32
39
  # Return the modified_version if the timestamps are the same (meaning no new assertions were made while the
33
40
  # user was working on the DMP ID) OR neither version has assertions
34
41
  return modified_version if latest_version['dmphub_updated_at'] == modified_version['dmphub_updated_at'] ||
35
42
  (latest_version.fetch('dmphub_assertions', []).empty? &&
36
43
  modified_version.fetch('dmphub_assertions', []).empty?)
37
44
 
38
- puts "LATEST_VERSION ASSERTIONS: #{latest_version['dmphub_assertions']}"
39
- puts "MODIFIED_VERSION ASSERTIONS: #{modified_version['dmphub_assertions']}"
40
-
41
45
  # Clone any existing assertions on the current DMP ID so we can manipulate them
42
46
  existing_assertions = Helper.deep_copy_dmp(obj: latest_version.fetch('dmphub_assertions', []))
43
47
  incoming_assertions = Helper.deep_copy_dmp(obj: modified_version.fetch('dmphub_assertions', []))
@@ -21,7 +21,7 @@ module Uc3DmpId
21
21
  # Fetch the latest version of the DMP ID
22
22
  client = Uc3DmpDynamo::Client.new
23
23
  latest_version = Finder.by_pk(p_key: p_key, client: client, logger: logger, cleanse: false)
24
- latest_version = latest_version.nil? ? {} : latest_version.fetch('dmp', {})
24
+ latest_version = latest_version['dmp'].nil? ? latest_version : latest_version.fetch('dmp', {})
25
25
  logger.debug(message: "Latest version for PK #{p_key}", details: latest_version) if logger.respond_to?(:debug)
26
26
 
27
27
  # Verify that the DMP ID is updateable with the info passed in
@@ -32,6 +32,9 @@ module Uc3DmpId
32
32
  raise UpdaterError, MSG_NO_CHANGE if Helper.eql?(dmp_a: latest_version, dmp_b: mods)
33
33
 
34
34
  # Version the DMP ID record (if applicable).
35
+
36
+ puts "OWNER: #{owner}, DMPHub PROV: #{latest_version['dmphub_provenance_id']}, DMP BURIED: #{latest_version.fetch('dmp', {})['dmphub_provenance_id']}"
37
+
35
38
  owner = latest_version['dmphub_provenance_id']
36
39
  updater = provenance['PK']
37
40
  version = Versioner.generate_version(client: client, latest_version: latest_version, owner: owner, updater: updater,
@@ -100,6 +103,9 @@ module Uc3DmpId
100
103
  end
101
104
 
102
105
  def _process_modifications(owner:, updater:, version:, mods:, note: nil, logger: nil)
106
+
107
+ puts "OWNER: #{owner}, UPDATER #{updater}, Version is Hash? #{version.is_a?(Hash)}, Mods is Hash? #{mods.is_a?(Hash)}"
108
+
103
109
  return version unless mods.is_a?(Hash) && !updater.nil?
104
110
  return mods unless version.is_a?(Hash) && !owner.nil?
105
111
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.100'
4
+ VERSION = '0.0.102'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.100
4
+ version: 0.0.102
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley