eco-helpers 1.3.9 → 1.3.10

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: 98e16aec9c1f34feae08b633ec05831ec6435a91b20a8d69afe9ddaedac18480
4
- data.tar.gz: 4a843f9036fdebb5468f0129f2c9c1d335f64372883a99d740e3b5ab48298601
3
+ metadata.gz: 861fdc294bb8624a1cebd3a880a94ae5c0067adb8b61b7e4467afd6b52e0c87a
4
+ data.tar.gz: e3db0ea2abda25621738bbe3cb7e50ebae1b68e7daaf16344ae1a74aa200aa9c
5
5
  SHA512:
6
- metadata.gz: 247f9baee2ff73214afab58a892b0f56eef831306f52a088b7499083a97ca1e5c6b1d2ec3316e3cc428e97a8797a79f24f9ce7bb355d7093170792e60682c9fc
7
- data.tar.gz: 74e2bbe2a950d760cbac18dd88631980b03e6d43406c4abf112f5adc4e6b74d8f3053717851866d1d9868a629d15f59c0768e1dfd923d1e26dcacebbd757c1fb
6
+ metadata.gz: d815d693a7208363238c96adb14250f6010c55b85158c236b157982754e73438f657e2d7639f4801a2530e1ba9952ec6496a6998b3a758a9728c056956fb4688
7
+ data.tar.gz: 10e1fdab93ce81884d01d474a82b41274c75bd168b52e1b525f53d127b15f8a9fa15759ac5b1b27de2b90997fe883628fec66dcffd443296f2abdb58d881065f
data/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [1.3.10] - 2020-05-12
5
+
6
+ ### Added
7
+ - `Eco::API::Organization::PolicyGroups#to_name` added support for `Array` input
8
+ - `config.people.default_usergroup`, when defined, will have effect on usecases: `update` (this case was missing the change)
9
+ * on account creation, if the input file did not specify `policy_group_ids`
10
+
11
+ ### Changed
12
+ ### Fixed
13
+ - `upsert`, `hris` and `create` usecases: fixed condition for use of default_usergroup
14
+
4
15
  ## [1.3.9] - 2020-05-12
5
16
 
6
17
  ### Added
@@ -8,7 +19,7 @@ All notable changes to this project will be documented in this file.
8
19
  ### Fixed
9
20
 
10
21
  - `usecase` callback was not receiving `usecase` paramater
11
- * as a consequence `Batch:Job` created were missing the `usecase`
22
+ * as a consequence `Batch::Job` created were missing the `usecase`
12
23
 
13
24
  ## [1.3.8] - 2020-05-07
14
25
 
@@ -19,7 +19,7 @@ module Eco
19
19
  def names
20
20
  @by_name.keys
21
21
  end
22
-
22
+
23
23
  def to_id(name)
24
24
  case name
25
25
  when Enumerable
@@ -32,10 +32,19 @@ module Eco
32
32
  end
33
33
 
34
34
  def to_name(id)
35
- policy_group(id)&.name
35
+ case id
36
+ when Enumerable
37
+ id.map do |n|
38
+ policy_group(n)&.name
39
+ end.compact
40
+ else
41
+ policy_group(id)&.name
42
+ end
43
+
36
44
  end
37
45
 
38
46
  def policy_group(id_name)
47
+ pp "the id: #{policy_group_id(id_name)}"
39
48
  @by_id.fetch(policy_group_id(id_name), nil)
40
49
  end
41
50
 
@@ -64,6 +73,7 @@ module Eco
64
73
  end
65
74
 
66
75
  def policy_group_id(id_name)
76
+ pp "by name ('#{id_name}'): #{@by_name[id_name&.downcase]}"
67
77
  (@by_name[id_name&.downcase] || @by_id[id_name])&.id
68
78
  end
69
79
 
@@ -51,7 +51,7 @@ module Eco
51
51
  unless options.dig(:exclude, :policy_groups) && !create
52
52
  end_pg_ids = person.account.policy_group_ids || []
53
53
 
54
- unless entry.policy_group_ids? && !add_account && !def_id
54
+ if add_account && def_id && !entry.policy_group_ids?
55
55
  # on account creation, if missing policy_group_ids column in the input
56
56
  # use default_usergroup, if it's defined
57
57
  end_pg_ids = [def_id]
@@ -65,7 +65,7 @@ module Eco
65
65
  unless options.dig(:exclude, :policy_groups) && !create
66
66
  end_pg_ids = person.account.policy_group_ids || []
67
67
 
68
- unless entry.policy_group_ids? && !add_account && !def_id
68
+ if add_account && def_id && !entry.policy_group_ids?
69
69
  # on account creation, if missing policy_group_ids column in the input
70
70
  # use default_usergroup, if it's defined
71
71
  end_pg_ids = [def_id]
@@ -46,11 +46,19 @@ module Eco
46
46
 
47
47
  person.account.send_invites = options[:send_invites] if options.key?(:send_invites)
48
48
 
49
- unless options.dig(:exclude, :policy_groups)
49
+ unless options.dig(:exclude, :policy_groups) && !create
50
+ end_pg_ids = person.account.policy_group_ids || []
51
+
52
+ if add_account && def_id && !entry.policy_group_ids?
53
+ # on account creation, if missing policy_group_ids column in the input
54
+ # use default_usergroup, if it's defined
55
+ end_pg_ids = [def_id]
56
+ end
57
+
50
58
  # avoid false updates by preserving the original order
51
59
  person.account.policy_group_ids = pgs.user_pg_ids(
52
60
  initial: ini_pg_ids,
53
- final: person.account.policy_group_ids
61
+ final: end_pg_ids
54
62
  )
55
63
  end
56
64
 
@@ -58,7 +58,7 @@ module Eco
58
58
  unless options.dig(:exclude, :policy_groups) && !create
59
59
  end_pg_ids = person.account.policy_group_ids || []
60
60
 
61
- unless entry.policy_group_ids? && !add_account && !def_id
61
+ if add_account && def_id && !entry.policy_group_ids?
62
62
  # on account creation, if missing policy_group_ids column in the input
63
63
  # use default_usergroup, if it's defined
64
64
  end_pg_ids = [def_id]
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "1.3.9"
2
+ VERSION = "1.3.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura