uc3-dmp-id 0.0.99 → 0.0.101
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-id/asserter.rb +11 -2
- data/lib/uc3-dmp-id/updater.rb +3 -0
- data/lib/uc3-dmp-id/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e0229f8a4684d78c921445d06df169216d6694a88264f8f1be8db079c4939f2
|
4
|
+
data.tar.gz: 991ec4969b516f29a5302b0700d73be81d15fc7aedfcbdd41e3bb590a399953a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 287a1c8dac5441229f937dd7e08ace46d8cf0395c4fbdbc43a874f95ff6d1baa0e782b6a98d68c45334ea0eb82390c6c84ae631231cfa8966a04ae1e0a4f4e2c
|
7
|
+
data.tar.gz: ecb4bc1d8a8d989cda2b44808f8bfb8f2b883d506884c2fe83b662f7493141fcfa32909f64fed8822d71eec01bf710d41cea0fdb930ba89adf5158dc5a274dff
|
data/lib/uc3-dmp-id/asserter.rb
CHANGED
@@ -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,9 +32,15 @@ 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
|
-
# user was working on the DMP ID)
|
34
|
-
return modified_version if latest_version['dmphub_updated_at'] == modified_version['dmphub_updated_at']
|
40
|
+
# user was working on the DMP ID) OR neither version has assertions
|
41
|
+
return modified_version if latest_version['dmphub_updated_at'] == modified_version['dmphub_updated_at'] ||
|
42
|
+
(latest_version.fetch('dmphub_assertions', []).empty? &&
|
43
|
+
modified_version.fetch('dmphub_assertions', []).empty?)
|
35
44
|
|
36
45
|
# Clone any existing assertions on the current DMP ID so we can manipulate them
|
37
46
|
existing_assertions = Helper.deep_copy_dmp(obj: latest_version.fetch('dmphub_assertions', []))
|
data/lib/uc3-dmp-id/updater.rb
CHANGED
@@ -100,6 +100,9 @@ module Uc3DmpId
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def _process_modifications(owner:, updater:, version:, mods:, note: nil, logger: nil)
|
103
|
+
|
104
|
+
puts "OWNER: #{owner}, UPDATER #{updater}, Version is Hash? #{version.is_a?(Hash)}, Mods is Hash? #{mods.is_a?(Hash)}"
|
105
|
+
|
103
106
|
return version unless mods.is_a?(Hash) && !updater.nil?
|
104
107
|
return mods unless version.is_a?(Hash) && !owner.nil?
|
105
108
|
|
data/lib/uc3-dmp-id/version.rb
CHANGED