uc3-dmp-id 0.0.76 → 0.0.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-id/updater.rb +11 -1
- 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: 46b976e1a1b1c6778fab08b24b77ce59e140b8bc40ae913fd6bca412e5eb3949
|
|
4
|
+
data.tar.gz: 3e3e704bed2b5781f3721237d91fe898d972338a7c235357afcde470e4d8b0fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 915115311a1d724470f2239b686cb82cfede0ccb0d52b312e3f3331be18927f75a5e07f900388baaf6b38c43f10259d0a39c318ef29d47153bac45f41672c7b8
|
|
7
|
+
data.tar.gz: 725027220b0481dc90ebfa0dd5b851190da6382f16012f161278ba766a0d91beb02c94dda0f889a376f5ae7f133582d2fce7b184ae1982990ee875492926d101
|
data/lib/uc3-dmp-id/updater.rb
CHANGED
|
@@ -13,12 +13,18 @@ module Uc3DmpId
|
|
|
13
13
|
raise UpdaterError, MSG_DMP_INVALID_DMP_ID unless p_key.is_a?(String) && !p_key.strip.empty?
|
|
14
14
|
|
|
15
15
|
dmp = Helper.parse_json(json: json)
|
|
16
|
-
errs = _updateable?(provenance: provenance, p_key: p_key,
|
|
16
|
+
errs = _updateable?(provenance: provenance, p_key: p_key, json: 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}"
|