eco-helpers 2.0.10 → 2.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/lib/eco/api/session/batch/errors.rb +1 -1
- data/lib/eco/api/session/batch/feedback.rb +6 -9
- data/lib/eco/api/session/batch/job.rb +3 -2
- data/lib/eco/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: 61ef9270db24cf1582814423b75bc1f3a74bf88cd14281862658c972d1f94f05
|
4
|
+
data.tar.gz: 30ac39b330426fcb8840b7e7456d240e6e7324030aea00b6950328708bbeb53b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dcfa4714c6b245c017194eb6b3fb623702472c260f5717b5485141fb9765fd7e10f891938e65978b7bc13142cc45e06efbc430db9cb63270355f6341e0991d3
|
7
|
+
data.tar.gz: 7cd4382209bef6d5b0db07b2adb90237500050b4ac9340ec39457f7f23d1131bc6562367bc5cf005fdcc4f3af1553dafd446aa02e551549b1bbb90c08e51e15d
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.0.
|
4
|
+
## [2.0.11] - 2021-03-xx
|
5
|
+
|
6
|
+
### Added
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- `Eco::API::Session::Batch:Errors#errors` changed `Array#filter` call to `Array#select` call
|
12
|
+
|
13
|
+
## [2.0.10] - 2021-03-26
|
5
14
|
|
6
15
|
### Added
|
7
16
|
- `Eco::API::Common::People::PersonParser`
|
@@ -124,7 +124,7 @@ module Eco
|
|
124
124
|
# - please, observe that this can only happen if there were repeated entries in the `source_queue`
|
125
125
|
# @return [Array<Hash>, Array<Ecoportal::API::V1::Person>, Array<Ecoportal::API::Internal::Person>]
|
126
126
|
def entries
|
127
|
-
queue.
|
127
|
+
queue.select.with_index do |query, i|
|
128
128
|
unless response = status[i]
|
129
129
|
msg = "Error: query with no response. You might have duplicated entries in your queue.\n"
|
130
130
|
msg += "Queue length: #{queue.length}; Queue elements class: #{queue.first.class}\n"
|
@@ -45,25 +45,22 @@ module Eco
|
|
45
45
|
# @!group Pure feedback methods
|
46
46
|
|
47
47
|
# Slightly modifies the behaviour of `Ecoportal::API::Common::BaseModel#as_update`, so schema details fields show the `alt_id`
|
48
|
+
# It also fixes possible patch updates that are incomplete or unnecessary.
|
48
49
|
# @note for better feedback
|
49
50
|
# @param entry [Hash, Ecoportal::API::V1::Person, Ecoportal::API::Internal::Person]
|
50
|
-
|
51
|
+
# @param add_feedback [Boolean] if `true` it tweak the hash update with additional data.
|
52
|
+
def as_update(entry, add_feedback: true)
|
51
53
|
case
|
52
54
|
when entry.is_a?(Hash)
|
53
55
|
hash = entry
|
54
56
|
else #entry.is_a?(Ecoportal::API::V1::Person)
|
55
57
|
if only_ids?
|
56
|
-
hash = {
|
57
|
-
"id" => entry.id,
|
58
|
-
"external_id" => entry.external_id,
|
59
|
-
"email" => entry.email
|
60
|
-
}
|
61
58
|
hash = entry.as_json.slice("id", "external_id", "email")
|
62
59
|
else
|
63
60
|
hash = entry.as_update
|
64
|
-
|
65
|
-
if hash["details"]
|
66
|
-
if hfields =
|
61
|
+
|
62
|
+
if add_feedback && details = hash["details"]
|
63
|
+
if hfields = details["fields"]
|
67
64
|
hfields.each do |fld|
|
68
65
|
fld.merge!("alt_id" => entry.details.get_field(fld["id"]).alt_id)
|
69
66
|
end
|
@@ -169,7 +169,8 @@ module Eco
|
|
169
169
|
|
170
170
|
unless simulate
|
171
171
|
if pqueue.length > 0
|
172
|
-
|
172
|
+
req_backup = pqueue.map {|e| as_update(e, add_feedback: false)}
|
173
|
+
backup_update(req_backup)
|
173
174
|
session.batch.launch(pqueue, method: type).tap do |job_status|
|
174
175
|
@status = job_status
|
175
176
|
status.root = self
|
@@ -217,7 +218,7 @@ module Eco
|
|
217
218
|
[].tap do |msg|
|
218
219
|
subjobs.map {|subjob| msg << subjob.summary}
|
219
220
|
end.join("\n")
|
220
|
-
end
|
221
|
+
end
|
221
222
|
|
222
223
|
def as_update(*args)
|
223
224
|
feedback.as_update(*args)
|
data/lib/eco/version.rb
CHANGED