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 +4 -4
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/lib/consyncful/tree/concerns/parent.rb +3 -5
- data/lib/consyncful/tree/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: 9e236700b0ed784be1e470b308e41c4ac2e8e403d0b94cfee3f98ba3bce8400e
|
4
|
+
data.tar.gz: dd82d688740c105509dc28cf36643ab84d33ea54034acb315aae512db0c4009c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
@@ -24,21 +24,19 @@ module Consyncful
|
|
24
24
|
|
25
25
|
next if key == "child_models" || child_ids.empty?
|
26
26
|
|
27
|
-
child_objects =
|
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
|
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
|
39
|
+
end.flatten
|
42
40
|
end
|
43
41
|
|
44
42
|
# Returns true/false if the parent has a child model with a specific class.
|