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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f769de6ae77fa371a710f13351629a90092a596131b31f82d7ad5161e792f12
4
- data.tar.gz: a3da20ecdce90334053349c726f4d4ed78abe00d5b915366957963be82ccbd40
3
+ metadata.gz: 46b976e1a1b1c6778fab08b24b77ce59e140b8bc40ae913fd6bca412e5eb3949
4
+ data.tar.gz: 3e3e704bed2b5781f3721237d91fe898d972338a7c235357afcde470e4d8b0fc
5
5
  SHA512:
6
- metadata.gz: f4a350af34ae4eff82a0c24c2de1e309b62ece8b268d53b23014ed05505dbe646c0a40f126a5a346c88047a30e790e52375cfed3956b879ee2ba5f2b94cf5ccc
7
- data.tar.gz: 9cda04030ef741a7f1f66eb62a7124755b572ae9791f8485a5081ac72c0efcd181b36e88f409b472078655bf7c2226f28b2956f16fb31e781ed362165ca4729d
6
+ metadata.gz: 915115311a1d724470f2239b686cb82cfede0ccb0d52b312e3f3331be18927f75a5e07f900388baaf6b38c43f10259d0a39c318ef29d47153bac45f41672c7b8
7
+ data.tar.gz: 725027220b0481dc90ebfa0dd5b851190da6382f16012f161278ba766a0d91beb02c94dda0f889a376f5ae7f133582d2fce7b184ae1982990ee875492926d101
@@ -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, dmp: dmp)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.76'
4
+ VERSION = '0.0.78'
5
5
  end
@@ -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}"
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.76
4
+ version: 0.0.78
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley