community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r924357 - /comdev/nearby_people/nearby/foaf.py
Date Wed, 17 Mar 2010 16:28:18 GMT
Author: nick
Date: Wed Mar 17 16:28:17 2010
New Revision: 924357

URL: http://svn.apache.org/viewvc?rev=924357&view=rev
Log:
When getting nearby people, if more than half of the requested number are under 1000km away,
then skip anyone in the list who is more

Modified:
    comdev/nearby_people/nearby/foaf.py

Modified: comdev/nearby_people/nearby/foaf.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/foaf.py?rev=924357&r1=924356&r2=924357&view=diff
==============================================================================
--- comdev/nearby_people/nearby/foaf.py (original)
+++ comdev/nearby_people/nearby/foaf.py Wed Mar 17 16:28:17 2010
@@ -45,6 +45,13 @@ class FOAF(object):
             for f in self.people.values()
         ]
         dists.sort( lambda x,y: int(x[0]-y[0]) )
+
+        # If we have more than half the requested number of rows
+        #  are under 1000km, then ditch the others
+        km1000 = 1000 * 1000.0
+        if len(dists) and dists[(rows/2)][0] <= km1000:
+           dists = [d for d in dists if d[0] <= km1000]
+
         return dists[:rows]
 
     def ensure_data(self):    



Mime
View raw message