uc3-dmp-id 0.0.76 → 0.0.77
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/updater.rb +10 -0
- data/lib/uc3-dmp-id/version.rb +1 -1
- data/lib/uc3-dmp-id/versioner.rb +7 -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: bae071224d4e143bf9f192f5b32bd755c752c0634c3314ec71480a3a48d1ad93
|
4
|
+
data.tar.gz: ff1e3c94a9e09dbd400833a5a90d1bb080dd6f2f47ad55c198982466daad578f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f477d5ae13ae8c352a720faa71a91532884db19859e9399962c1481966d98610a407c2b5abf16e33d09a19061f2643dee1b91315df88983654671a64f0279461
|
7
|
+
data.tar.gz: 0f4c206e3fa4b5ac476b6e39f89a24926b75637115819d83c55aa5eddbc2b37de54e7dfe0355c70a8f28441c09fa50d299c9b935cc77aa3026056fcf243e2e24
|
data/lib/uc3-dmp-id/updater.rb
CHANGED
@@ -14,11 +14,17 @@ module Uc3DmpId
|
|
14
14
|
|
15
15
|
dmp = Helper.parse_json(json: json)
|
16
16
|
errs = _updateable?(provenance: provenance, p_key: p_key, dmp: dmp)
|
17
|
+
|
18
|
+
puts "Updateable? #{errs}"
|
19
|
+
|
17
20
|
raise UpdaterError, errs if errs.is_a?(Array) && errs.any?
|
18
21
|
|
19
22
|
# Add the DMPHub specific attributes
|
20
23
|
annotated = Helper.annotate_dmp(provenance: provenance, json: dmp['dmp'], p_key: p_key)
|
21
24
|
|
25
|
+
puts 'Annotated:'
|
26
|
+
puts annotated
|
27
|
+
|
22
28
|
# fetch the existing latest version of the DMP ID
|
23
29
|
client = Uc3DmpDynamo::Client.new(debug: debug)
|
24
30
|
existing = Finder.by_pk(p_key: p_key, client: client, debug: debug)
|
@@ -27,6 +33,10 @@ module Uc3DmpId
|
|
27
33
|
|
28
34
|
# Generate a new version of the DMP. This involves versioning the current latest version
|
29
35
|
new_version = versioner.new_version(p_key: p_key, dmp: json)
|
36
|
+
|
37
|
+
puts 'DMP after splicing all changes:'
|
38
|
+
puts new_version
|
39
|
+
|
30
40
|
raise UpdaterError, MSG_DMP_UNABLE_TO_VERSION if new_version.nil?
|
31
41
|
|
32
42
|
# Save the changes as the new latest version
|
data/lib/uc3-dmp-id/version.rb
CHANGED
data/lib/uc3-dmp-id/versioner.rb
CHANGED
@@ -46,7 +46,7 @@ module Uc3DmpId
|
|
46
46
|
|
47
47
|
args = { owner: owner, updater: updater, base: prior, mods: dmp, debug: debug }
|
48
48
|
puts 'DMP ID update prior to splicing changes' if debug
|
49
|
-
puts dmp
|
49
|
+
puts dmp if debug
|
50
50
|
|
51
51
|
args = { owner: owner, updater: updater, base: prior, mods: dmp, debug: debug }
|
52
52
|
# If the system of provenance is making the change then just use the
|
@@ -96,9 +96,15 @@ module Uc3DmpId
|
|
96
96
|
# Only create a version if the Updater is not the Owner OR the changes have happened on a different day
|
97
97
|
mod_time = Time.parse(latest_version.fetch('dmphub_updated_at', Time.now.iso8601))
|
98
98
|
now = Time.now
|
99
|
+
|
100
|
+
puts "_generate_version -- mod_time: #{mod_time} --> !(now - mod_time).is_a?(Float)"
|
101
|
+
|
99
102
|
return latest_version if mod_time.nil? || !(now - mod_time).is_a?(Float)
|
100
103
|
|
101
104
|
same_hour = (now - mod_time).round <= 3600
|
105
|
+
|
106
|
+
puts "_generate_version -- owner is updater? #{owner == updater}, same hour? #{same_hour}"
|
107
|
+
|
102
108
|
return latest_version if owner != updater || (owner == updater && same_hour)
|
103
109
|
|
104
110
|
latest_version['SK'] = "#{Helper::SK_DMP_PREFIX}#{latest_version['dmphub_updated_at'] || Time.now.iso8601}"
|