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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f769de6ae77fa371a710f13351629a90092a596131b31f82d7ad5161e792f12
4
- data.tar.gz: a3da20ecdce90334053349c726f4d4ed78abe00d5b915366957963be82ccbd40
3
+ metadata.gz: bae071224d4e143bf9f192f5b32bd755c752c0634c3314ec71480a3a48d1ad93
4
+ data.tar.gz: ff1e3c94a9e09dbd400833a5a90d1bb080dd6f2f47ad55c198982466daad578f
5
5
  SHA512:
6
- metadata.gz: f4a350af34ae4eff82a0c24c2de1e309b62ece8b268d53b23014ed05505dbe646c0a40f126a5a346c88047a30e790e52375cfed3956b879ee2ba5f2b94cf5ccc
7
- data.tar.gz: 9cda04030ef741a7f1f66eb62a7124755b572ae9791f8485a5081ac72c0efcd181b36e88f409b472078655bf7c2226f28b2956f16fb31e781ed362165ca4729d
6
+ metadata.gz: f477d5ae13ae8c352a720faa71a91532884db19859e9399962c1481966d98610a407c2b5abf16e33d09a19061f2643dee1b91315df88983654671a64f0279461
7
+ data.tar.gz: 0f4c206e3fa4b5ac476b6e39f89a24926b75637115819d83c55aa5eddbc2b37de54e7dfe0355c70a8f28441c09fa50d299c9b935cc77aa3026056fcf243e2e24
@@ -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
@@ -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.77'
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.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley