consyncful-tree 1.0.1 → 1.0.3

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: de96606e91d4b2f832cb42429df45f2794cb07526ece0a98e7766384bfabb430
4
- data.tar.gz: 32b4749935b9c503e1b6171f09a6b7fe92d1afaec510db1402dc7c377812be8c
3
+ metadata.gz: fc3e8c65e29ce814609bbf279b96bb29d320e4e38d11cdf900b7f5828b805ee1
4
+ data.tar.gz: 3a6fe92a6aef5055b02bf6606a4d100392da58f0e2c961ac507620555d8b9ce4
5
5
  SHA512:
6
- metadata.gz: 4a8e3e4db80d8b746872e2809715e549def805ab0737bbb3e6d0989e3ea29f0a32428f11e2ddb984055d14d7a2d787eeef966383d8ecebd3a0a2df706f44aebf
7
- data.tar.gz: 270dd99f798052d23b6372dc9602c395fe343ee00e9a2aee904a5ec09b731e86d97556d6ac23e179cb0c1651f57a012b2c143cca4d8fac962c34ff12e1c1420b
6
+ metadata.gz: 8ed11d0980029dbf5709a770ff52ce35ef65494f99c6e63e019be2dd0c49941f2c25982b61be5d34ad9b0e9f22e783dd0149a875570f1310a708850691d43a0e
7
+ data.tar.gz: d6c4cea50d27506cf428ebdb14933177adb9050af79a34a4f51a025bbc26f21d48280ea12a3d98be1eb7428c28e854c2a4ab764d7aaaf903a7d1f09e040ab79c
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,30 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- consyncful-tree (1.0.1)
5
- consyncful (~> 0.7.0)
4
+ consyncful-tree (1.0.3)
5
+ consyncful (>= 0.7.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (7.0.3)
11
- activesupport (= 7.0.3)
12
- activesupport (7.0.3)
10
+ activemodel (7.0.4.2)
11
+ activesupport (= 7.0.4.2)
12
+ activesupport (7.0.4.2)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 1.6, < 2)
15
15
  minitest (>= 5.1)
16
16
  tzinfo (~> 2.0)
17
- addressable (2.8.0)
18
- public_suffix (>= 2.0.2, < 5.0)
17
+ addressable (2.8.1)
18
+ public_suffix (>= 2.0.2, < 6.0)
19
19
  ast (2.4.2)
20
20
  bson (4.15.0)
21
21
  byebug (11.1.3)
22
22
  coderay (1.1.3)
23
- concurrent-ruby (1.1.10)
24
- consyncful (0.7.0)
23
+ concurrent-ruby (1.2.0)
24
+ consyncful (0.8.0)
25
25
  contentful (>= 2.11.1, < 3.0.0)
26
26
  hooks (>= 0.4.1)
27
- mongoid (>= 7.0.2, < 8.0.0)
27
+ mongoid (>= 7.0.2, < 9.0.0)
28
28
  rainbow
29
29
  contentful (2.16.3)
30
30
  http (> 0.8, < 5.0)
@@ -52,15 +52,15 @@ GEM
52
52
  http-form_data (2.3.0)
53
53
  http-parser (1.2.3)
54
54
  ffi-compiler (>= 1.0, < 2.0)
55
- i18n (1.10.0)
55
+ i18n (1.12.0)
56
56
  concurrent-ruby (~> 1.0)
57
57
  method_source (1.0.0)
58
- minitest (5.15.0)
59
- mongo (2.17.1)
60
- bson (>= 4.8.2, < 5.0.0)
61
- mongoid (7.4.0)
58
+ minitest (5.17.0)
59
+ mongo (2.18.2)
60
+ bson (>= 4.14.1, < 5.0.0)
61
+ mongoid (8.0.3)
62
62
  activemodel (>= 5.1, < 7.1, != 7.0.0)
63
- mongo (>= 2.10.5, < 3.0.0)
63
+ mongo (>= 2.18.0, < 3.0.0)
64
64
  ruby2_keywords (~> 0.0.5)
65
65
  multi_json (1.15.0)
66
66
  parallel (1.22.1)
@@ -72,7 +72,7 @@ GEM
72
72
  pry-byebug (3.9.0)
73
73
  byebug (~> 11.0)
74
74
  pry (~> 0.13.0)
75
- public_suffix (4.0.7)
75
+ public_suffix (5.0.1)
76
76
  rainbow (3.1.1)
77
77
  rake (13.0.6)
78
78
  regexp_parser (2.5.0)
@@ -107,7 +107,7 @@ GEM
107
107
  rubocop (~> 1.19)
108
108
  ruby-progressbar (1.11.0)
109
109
  ruby2_keywords (0.0.5)
110
- tzinfo (2.0.4)
110
+ tzinfo (2.0.6)
111
111
  concurrent-ruby (~> 1.0)
112
112
  uber (0.0.15)
113
113
  unf (0.1.4)
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency "rubocop-rake"
38
38
  spec.add_development_dependency "rubocop-rspec"
39
39
 
40
- spec.add_dependency "consyncful", "~> 0.7.0"
40
+ spec.add_dependency "consyncful", ">= 0.7.0"
41
41
 
42
42
  # For more information and examples about making a new gem, check out our
43
43
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -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.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - DigitalNZ
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-19 00:00:00.000000000 Z
11
+ date: 2023-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,14 +126,14 @@ dependencies:
126
126
  name: consyncful
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.7.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.7.0
139
139
  description: Code to help with adding a tree structure to Contentful models.