Permalink
Browse files

Re-adding algo filters and cleaning up old debug statements.

  • Loading branch information...
1 parent 2bb5be9 commit 9cfbce1354ebe895750099fd9267b74fdc6b3380 @jplewicke committed Mar 26, 2011
Showing with 4 additions and 6 deletions.
  1. +3 −2 app_classes.rb
  2. +1 −4 neo_classes.rb
View
5 app_classes.rb
@@ -138,17 +138,18 @@ def initialize(source, dest)
#Update paths.
def refresh!
- path_algo = Neo4j::Algo.shortest_path(@source,@dest)
+ path_algo = Neo4j::Algo.shortest_path(@source,@dest).outgoing(:activelytrusts).depth(@depth)
if path_algo.nil?
@users = []
@credits = []
else
java_nodes = []
begin
java_nodes = path_algo.collect {|jnode| jnode }
+
+ #NoMethodError will be raised when no path can be found.
rescue NoMethodError
java_nodes = []
- puts "weird error thing"
end
@users = java_nodes.collect {|jnode| User.load_wrapper(jnode)}
@credits = @users.each_cons(2).collect {|pair| CreditRelationship.new(pair.first, pair.last)}
View
5 neo_classes.rb
@@ -65,10 +65,7 @@ class User
index :user_id
def trustrel(dest)
-
if self.trusts.include?(dest)
- #puts "yippee"
-
rel = self.rels(:trusts).outgoing.find {|r| r.getEndNode == dest}
else
rel = self.trusts.new(dest)
@@ -78,7 +75,7 @@ def trustrel(dest)
rel.amount_held = 0.0
end
- return rel
+ rel
end

0 comments on commit 9cfbce1

Please sign in to comment.