graph_starter 0.8.1 → 0.8.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
  SHA1:
3
- metadata.gz: 7f268e07959bd566a5d5c5e0773846f0454f6e5d
4
- data.tar.gz: 48697207b77f1ddafd3b853bfd955ef30f3cf8c3
3
+ metadata.gz: 45aeeb768a868dfa0b8cb6d65a4c3cfaf05415a6
4
+ data.tar.gz: 407b4b579be11348a16f4c47f7efab0ae3050cb0
5
5
  SHA512:
6
- metadata.gz: d0b513d1332671e802dccd3be5c022b2bb7f341270ed7f4ee2c5f2368d1a95f8d546e4a2c1e64d94fb0b304b3efbde3c80919aabcf78197e852b5aca9a871944
7
- data.tar.gz: 1c70553abcb24072f99cc3214a89cd473791c3cb256ba05a411c13440cc09ee9325a63fc238aba87541cd5d2f234904acb6701309230d50e0f76adecde0615c7
6
+ metadata.gz: 6bfe075cdbabe38663dd5ecf653a2960bc8c999d791ee5bfed92fe9fccad50e9fba7674c4b54314e040ea3661c7209cbb5ca46556cb3ec9d0525b34214b275e6
7
+ data.tar.gz: 778dfd381ed626d572f9f9c05497a0ef93cfa01840f4753d1a20cf78e89e1a4be64d331a943c681a3d29b1a3c5d9e9d3f879a133addac2e2d47749c92950f8c1
@@ -4,6 +4,7 @@ module GraphStarter
4
4
  end
5
5
 
6
6
  def index
7
+ @all_assets = asset_set(:asset, nil)
7
8
  @assets = asset_set.to_a
8
9
  end
9
10
 
@@ -31,7 +32,7 @@ module GraphStarter
31
32
  render json: {results: results_data}.to_json
32
33
  end
33
34
 
34
- def asset_set(var = :asset)
35
+ def asset_set(var = :asset, limit = 50)
35
36
  associations = []
36
37
  associations << model_class.image_association
37
38
  associations << model_class.category_association
@@ -40,7 +41,7 @@ module GraphStarter
40
41
  scope = model_class_scope(var)
41
42
  scope = yield scope if block_given?
42
43
 
43
- scope = scope.limit(50)
44
+ scope = scope.limit(limit)
44
45
 
45
46
  scope = if associations.present?
46
47
  scope.query_as(var).with(var).proxy_as(model_class, var).with_associations(*associations)
@@ -147,8 +147,7 @@ module GraphStarter
147
147
  def safe_title
148
148
  sanitizer = Rails::Html::WhiteListSanitizer.new
149
149
 
150
- self.html = sanitizer.sanitize(title, tags: %w(b em i strong))
151
-
150
+ sanitizer.sanitize(title, tags: %w(b em i strong))
152
151
  end
153
152
 
154
153
  def self.body_property(property_name = nil)
@@ -31,14 +31,14 @@ module GraphStarter
31
31
  to_node.save
32
32
  end
33
33
 
34
- def self.record_view(user, target, properties = {})
35
- test_view = new(properties.merge(from_node: user, to_node: target))
34
+ def self.record_view(session, target, properties = {})
35
+ test_view = new(properties.merge(from_node: session, to_node: target))
36
36
  return test_view.errors if !test_view.valid?
37
37
 
38
38
  query = <<-CYPHER
39
- MATCH (user), (target)
40
- WHERE ID(user) = {user_id} AND ID(target) = {target_id}
41
- MERGE (user)-[view_rel:VIEWED]->(target)
39
+ MATCH (session), (target)
40
+ WHERE ID(session) = {session_id} AND ID(target) = {target_id}
41
+ MERGE (session)-[view_rel:VIEWED]->(target)
42
42
  ON CREATE SET
43
43
  view_rel.created_at = {timestamp},
44
44
  view_rel.count = 0
@@ -51,7 +51,7 @@ module GraphStarter
51
51
  CYPHER
52
52
 
53
53
  Neo4j::Session.current.query(query,
54
- user_id: user.neo_id,
54
+ session_id: session.neo_id,
55
55
  target_id: target.neo_id,
56
56
  browser_string: properties[:browser_string],
57
57
  ip_address: properties[:ip_address],
@@ -14,7 +14,7 @@
14
14
  $.fn.api.settings.api = {search: "/#{@model_slug}/search/{query}.json"}
15
15
 
16
16
  - count = @assets.size
17
- - total_count = @model_class_scope.count
17
+ - total_count = @all_assets.count
18
18
  .stacked.segment Displaying #{[count, total_count].min} of #{number_to_human(total_count)} total
19
19
 
20
20
  .ui.divider
@@ -1,3 +1,3 @@
1
1
  module GraphStarter
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graph_starter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Underwood