Don't list yourself in the nearby mappers
authorJohn McKerrell <john@mckerrell.net>
Sat, 5 May 2007 15:00:16 +0000 (15:00 +0000)
committerJohn McKerrell <john@mckerrell.net>
Sat, 5 May 2007 15:00:16 +0000 (15:00 +0000)
app/models/user.rb

index f7a4122a3afa9c3b56ec897ff7d4ac71eaf0d3b1..1261e5a181ec46886f568344d815b2ff9a1d0b24 100644 (file)
@@ -62,7 +62,7 @@ class User < ActiveRecord::Base
 
   def nearby(lat_range=1, lon_range=1)
       if self.home_lon and self.home_lat 
-          nearby = User.find(:all,  :conditions => "#{self.home_lon} > home_lon - #{lon_range} and #{self.home_lon} < home_lon + #{lon_range} and  #{self.home_lon} > home_lon - #{lon_range} and #{self.home_lon} < home_lon + #{lon_range} and data_public = 1") 
+          nearby = User.find(:all,  :conditions => "#{self.home_lon} > home_lon - #{lon_range} and #{self.home_lon} < home_lon + #{lon_range} and  #{self.home_lon} > home_lon - #{lon_range} and #{self.home_lon} < home_lon + #{lon_range} and data_public = 1 and id != #{self.id}") 
       else
           nearby = []
       end