graph_starter 0.14.6 → 0.15.0

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
  SHA1:
3
- metadata.gz: af3ebbb0d7e98993000aeed3a0df05a1c213f2f6
4
- data.tar.gz: 452364eca36cb433fc14f85c93e5c1dee7b2d95d
3
+ metadata.gz: a8ee3a54564d68390d0217398ae1580cb396d9a6
4
+ data.tar.gz: eb186700dc742741779ff24e52a70c05ef34c0bc
5
5
  SHA512:
6
- metadata.gz: 54bbe2a6462277094f98f0ad2ee743046bcad7c97dafa55b089a6940f8958126bca5373570d8edeec9e8820904fc97b276cfa887ac24825f17d8f2e3ed5b5b3b
7
- data.tar.gz: 0a89a565dd883c2fe552ad7401a6fd7adb87172288f72365a010afde554e87f0b0e6fb965c0f3665ad33d40cdfff9787759ec2062d19c99c498db70153eaa9c7
6
+ metadata.gz: c9df04085c5e00c64caed53f08eef48da9b7d3fc81762343b5b080fd69269aa18fbc4cf18ab8bb9b79d9cc77a6948e3efd9e0a4022827967fd2e2e5127d87914
7
+ data.tar.gz: 963a1890f3dc82e0c0b9ec27c8756f881405f1d4f20d46fc2961ccb6ab5de71847bc03ffa1607b96be69b2e7e7c204829ea3d5308cbdee58f54233a6ba4be008
@@ -311,15 +311,11 @@ module GraphStarter
311
311
  query, associations = if category_associations.size > 0
312
312
  query = all(:asset).query
313
313
 
314
- last_associations_var = "categories#{category_associations.size - 1}"
315
- query = category_associations.each_with_index.inject(query) do |query, (association_name, i)|
316
- category_association = self.associations[association_name]
317
- clause = "(asset)#{category_association.arrow_cypher}(category:#{category_association.target_class})"
318
-
319
- query.optional_match(clause).with(:asset, "#{"categories#{i-1} +" if i > 0} collect(category) AS categories#{i}")
320
- end
321
- .with("asset, CASE #{last_associations_var} WHEN [] THEN [null] ELSE #{last_associations_var} END AS #{last_associations_var}")
322
- .unwind(category: last_associations_var)
314
+ category_associations
315
+
316
+ relationship_types_cypher = category_associations.map {|name| self.associations[name].relationship_type }.join('|:')
317
+
318
+ query = query.optional_match("(asset)-[:#{relationship_types_cypher}]-(category:Asset)")
323
319
 
324
320
  [query,
325
321
  [:asset, :category]]
@@ -1,3 +1,3 @@
1
1
  module GraphStarter
2
- VERSION = "0.14.6"
2
+ VERSION = "0.15.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graph_starter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.6
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Underwood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2015-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails