consyncful-tree 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de96606e91d4b2f832cb42429df45f2794cb07526ece0a98e7766384bfabb430
4
- data.tar.gz: 32b4749935b9c503e1b6171f09a6b7fe92d1afaec510db1402dc7c377812be8c
3
+ metadata.gz: 9e236700b0ed784be1e470b308e41c4ac2e8e403d0b94cfee3f98ba3bce8400e
4
+ data.tar.gz: dd82d688740c105509dc28cf36643ab84d33ea54034acb315aae512db0c4009c
5
5
  SHA512:
6
- metadata.gz: 4a8e3e4db80d8b746872e2809715e549def805ab0737bbb3e6d0989e3ea29f0a32428f11e2ddb984055d14d7a2d787eeef966383d8ecebd3a0a2df706f44aebf
7
- data.tar.gz: 270dd99f798052d23b6372dc9602c395fe343ee00e9a2aee904a5ec09b731e86d97556d6ac23e179cb0c1651f57a012b2c143cca4d8fac962c34ff12e1c1420b
6
+ metadata.gz: 99fac17c55d9eb5d83fca8c07df07961ac4cb854da3b00af075128e0036b3842e8eaa18a4504ccf7601063cc13356d69216b233efe05e57a19ee18e97dcc6c60
7
+ data.tar.gz: 637ff51cab4e721a98a3c43206dc4a9bedd0107d93594f3bc19316a9fb10c5e29f5ca9291e2084b5416de3071b8d5c626fee1ae670ac55c75d54d8929c1920db
data/CHANGELOG.md CHANGED
@@ -6,4 +6,8 @@
6
6
 
7
7
  ## [1.0.1] - 2022-06-20
8
8
 
9
- - Fixed a bug in the break condition which caused infinite loops
9
+ - Fixed a bug in the break condition which caused infinite loops
10
+
11
+ ## [1.0.2] - 22-06-20
12
+
13
+ - Reduced the number of lookups when calculating a parent's children
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- consyncful-tree (1.0.1)
4
+ consyncful-tree (1.0.2)
5
5
  consyncful (~> 0.7.0)
6
6
 
7
7
  GEM
@@ -24,21 +24,19 @@ module Consyncful
24
24
 
25
25
  next if key == "child_models" || child_ids.empty?
26
26
 
27
- child_objects = child_ids.map { |id| Consyncful::Base.where(id: id).first }
27
+ child_objects = Consyncful::Base.where(id: { "$in": child_ids })
28
28
 
29
29
  child_ids + lookup_child_model_ids_for_list(child_objects)
30
- end.flatten.compact
30
+ end.flatten
31
31
  end
32
32
 
33
33
  def lookup_child_model_ids_for_list(child_objects)
34
34
  return [] if child_objects.empty?
35
35
 
36
36
  child_objects.map do |obj|
37
- next if obj.nil?
38
-
39
37
  obj_is_parent = classes_with_parent_concern.include?(obj.class)
40
38
  lookup_child_model_ids(context: obj) unless obj_is_parent
41
- end.flatten.compact
39
+ end.flatten
42
40
  end
43
41
 
44
42
  # Returns true/false if the parent has a child model with a specific class.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Consyncful
4
4
  module Tree
5
- VERSION = "1.0.1"
5
+ VERSION = "1.0.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consyncful-tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - DigitalNZ