eco-helpers 2.7.22 → 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 +20 -3
- data/lib/eco/api/common/people/person_entry.rb +2 -1
- data/lib/eco/api/common/session/file_manager.rb +5 -4
- data/lib/eco/api/microcases/with_each.rb +21 -19
- data/lib/eco/data/files/helpers.rb +7 -5
- 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,19 +2,36 @@
|
|
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
|
|
9
9
|
### Changed
|
10
10
|
|
11
|
+
### Fixed
|
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
|
+
|
20
|
+
## [2.7.23] - 2024-07-29
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
|
24
|
+
- Filename and path scoping
|
25
|
+
|
26
|
+
## [2.7.22] - 2024-07-26
|
27
|
+
|
28
|
+
### Changed
|
29
|
+
|
11
30
|
- Patch on exception: to show cause
|
12
31
|
- `Eco::Common::Session::FileManager`
|
13
32
|
- `load_json` prevent avoidable memory leaks
|
14
33
|
- `save_json` prevent avoidable memory leaks
|
15
34
|
|
16
|
-
### Fixed
|
17
|
-
|
18
35
|
## [2.7.21] - 2024-07-13
|
19
36
|
|
20
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
|
@@ -17,10 +17,10 @@ module Eco
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def dir_path=(value)
|
20
|
-
@dir
|
20
|
+
@dir = Eco::Data::Files::Directory.new(value)
|
21
21
|
@dir_path = @dir.create
|
22
|
-
rescue StandardError =>
|
23
|
-
logger.error("could not create or make any sense of directory '#{value}': #{
|
22
|
+
rescue StandardError => err
|
23
|
+
logger.error("could not create or make any sense of directory '#{value}': #{err}")
|
24
24
|
end
|
25
25
|
|
26
26
|
def logger
|
@@ -123,7 +123,8 @@ module Eco
|
|
123
123
|
|
124
124
|
def filename_for(filename, modifier = :no_stamp)
|
125
125
|
file = dir.file(filename)
|
126
|
-
FileManager.timestamp_file(file) if modifier == :timestamp
|
126
|
+
file = FileManager.timestamp_file(file) if modifier == :timestamp
|
127
|
+
file
|
127
128
|
end
|
128
129
|
end
|
129
130
|
end
|
@@ -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)
|
@@ -54,19 +54,21 @@ module Eco
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def file_name(fullname)
|
57
|
+
return nil unless fullname
|
58
|
+
|
57
59
|
File.basename(fullname)
|
58
60
|
end
|
59
61
|
|
60
62
|
def file_basename(fullname)
|
61
|
-
|
62
|
-
end
|
63
|
+
return nil unless fullname
|
63
64
|
|
64
|
-
|
65
|
-
File.dirname(fullname)
|
65
|
+
File.basename(fullname, File.extname(fullname))
|
66
66
|
end
|
67
67
|
|
68
68
|
def file_fullpath(fullname)
|
69
|
-
|
69
|
+
return nil unless fullname
|
70
|
+
|
71
|
+
File.dirname(File.expand_path(fullname))
|
70
72
|
end
|
71
73
|
|
72
74
|
def file_exists?(file)
|
data/lib/eco/version.rb
CHANGED