eco-helpers 2.7.23 → 2.7.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -5
- data/lib/eco/api/common/people/person_entry.rb +2 -1
- data/lib/eco/api/microcases/with_each.rb +21 -19
- 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: 6576d3f9439855c0004110d104d82634733df41822acb362bc82cafcbf90d6ca
|
4
|
+
data.tar.gz: e0052851a9c33b54c77bcb4577874cb765e744c40ed63b7eaa5a5fd3d59632ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 479a0ed0a903b1f05a930673e0098912df91cb66a49b1acb99d2b7c82dd531f9bcd4704f46c0a4a84ad9f8c2e12a0469ccbc1b8760cba65fae1e7e272d6575aa
|
7
|
+
data.tar.gz: 5f626293d3de079368627f68eb5337abe64afde56f86248721ed3615a90d7e694cacde99fe78467e50fb4c24a8d19cb66670cffc14f63c08ab1b4735d9652041
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
-
## [2.7.
|
5
|
+
## [2.7.25] - 2024-07-xx
|
6
6
|
|
7
7
|
### Added
|
8
8
|
|
@@ -10,6 +10,13 @@ All notable changes to this project will be documented in this file.
|
|
10
10
|
|
11
11
|
### Fixed
|
12
12
|
|
13
|
+
## [2.7.24] - 2024-07-30
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
- `Eco::API::Common::People::PersonEntry#set_core`
|
18
|
+
- Exclude setting `id` (should invariably be set via back-end only)
|
19
|
+
|
13
20
|
## [2.7.23] - 2024-07-29
|
14
21
|
|
15
22
|
### Fixed
|
@@ -18,8 +25,6 @@ All notable changes to this project will be documented in this file.
|
|
18
25
|
|
19
26
|
## [2.7.22] - 2024-07-26
|
20
27
|
|
21
|
-
### Added
|
22
|
-
|
23
28
|
### Changed
|
24
29
|
|
25
30
|
- Patch on exception: to show cause
|
@@ -27,8 +32,6 @@ All notable changes to this project will be documented in this file.
|
|
27
32
|
- `load_json` prevent avoidable memory leaks
|
28
33
|
- `save_json` prevent avoidable memory leaks
|
29
34
|
|
30
|
-
### Fixed
|
31
|
-
|
32
35
|
## [2.7.21] - 2024-07-13
|
33
36
|
|
34
37
|
### Added
|
@@ -211,7 +211,8 @@ module Eco
|
|
211
211
|
# @param person [Ecoportal::API::V1::Person] the person we want to set the core values to.
|
212
212
|
# @param exclude [String, Array<String>] core attributes that should not be set/changed to the person.
|
213
213
|
def set_core(person, exclude: nil)
|
214
|
-
scoped_attrs
|
214
|
+
scoped_attrs = @emap.core_attrs(@final_entry) - into_a(exclude)
|
215
|
+
scoped_attrs -= ['id']
|
215
216
|
@final_entry.slice(*scoped_attrs).each do |attr, value|
|
216
217
|
set_part(person, attr, value)
|
217
218
|
rescue StandardError => e
|
@@ -15,12 +15,12 @@ module Eco
|
|
15
15
|
def with_each(entries, people, options, append_created: true)
|
16
16
|
@_skip_all_multiple_results = false
|
17
17
|
people_copy = people.newFrom(people.to_a)
|
18
|
+
|
18
19
|
entries.each_with_object([]) do |entry, scoped|
|
19
20
|
begin
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
21
|
+
person = people_copy.find(entry, strict: micro.strict_search?(options))
|
22
|
+
person ||= session.new_person.tap do |pers|
|
23
|
+
people << pers if append_created
|
24
24
|
end
|
25
25
|
rescue Eco::API::Organization::People::MultipleSearchResults => e
|
26
26
|
unless @_skip_all_multiple_results
|
@@ -29,17 +29,19 @@ module Eco
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end.
|
32
|
+
next unless person
|
33
|
+
|
34
|
+
person.entry = entry
|
35
|
+
yield(entry, person) if block_given?
|
36
|
+
scoped << person
|
37
|
+
end.then do |all_people|
|
38
|
+
people.newFrom all_people.uniq
|
39
|
+
end
|
38
40
|
end
|
39
41
|
|
40
42
|
private
|
41
43
|
|
42
|
-
def _with_each_prompt_to_select_user(error, entry: nil, increase_count: true)
|
44
|
+
def _with_each_prompt_to_select_user(error, entry: nil, increase_count: true) # rubocop:disable Metrics/AbcSize
|
43
45
|
unless error.is_a?(Eco::API::Organization::People::MultipleSearchResults)
|
44
46
|
raise "Expecting Eco::API::Organization::People::MultipleSearchResults. Given: #{error.class}"
|
45
47
|
end
|
@@ -47,7 +49,7 @@ module Eco
|
|
47
49
|
@_with_each_prompts += 1 if increase_count
|
48
50
|
|
49
51
|
lines = []
|
50
|
-
lines << "\n(#{@_with_each_prompts})
|
52
|
+
lines << "\n(#{@_with_each_prompts}) #{error}\n"
|
51
53
|
lines << " #index - Select the correct person by its number index among the list above."
|
52
54
|
lines << " (I) - Just Skip/Ignore this one. I will deal with that input entry in another launch."
|
53
55
|
lines << " (A) - Ignore all the rest of input entries with this problem."
|
@@ -56,20 +58,20 @@ module Eco
|
|
56
58
|
|
57
59
|
prompt_user("Type one option (#number/I/A/C/B):", explanation: lines.join("\n"), default: "I") do |res|
|
58
60
|
res = res.upcase
|
59
|
-
|
60
|
-
|
61
|
-
logger.info "Ignoring entry... #{entry
|
61
|
+
|
62
|
+
if res.start_with?("I")
|
63
|
+
logger.info "Ignoring entry... #{entry&.to_s(:identify)}"
|
62
64
|
nil
|
63
|
-
|
65
|
+
elsif res.start_with?("A")
|
64
66
|
logger.info "All input entries with this same issue will be ignored for this launch"
|
65
67
|
@_skip_all_multiple_results = true
|
66
68
|
nil
|
67
|
-
|
69
|
+
elsif res.start_with?("C")
|
68
70
|
logger.info "Creating new person...#{"for entry #{entry.to_s(:identify)}" if entry}"
|
69
71
|
session.new_person
|
70
|
-
|
72
|
+
elsif res.start_with?("B")
|
71
73
|
raise error
|
72
|
-
|
74
|
+
elsif res && !res.empty? && (pos = res.to_i rescue nil) && (pos < error.candidates.length) # rubocop:disable Style/RescueModifier
|
73
75
|
error.candidate(pos).tap do |person|
|
74
76
|
logger.info "Thanks!! You selected #{person.identify}"
|
75
77
|
sleep(1.5)
|
data/lib/eco/version.rb
CHANGED