You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by ni...@apache.org on 2010/06/12 16:46:04 UTC
svn commit: r954015 - in /comdev/nearby_people: nearby/foaf.py
nearby/views.py templates/people.html
Author: nick
Date: Sat Jun 12 14:46:04 2010
New Revision: 954015
URL: http://svn.apache.org/viewvc?rev=954015&view=rev
Log:
Slight tweak when we exclude people a long way away, and give a more help when people are a long way off
Modified:
comdev/nearby_people/nearby/foaf.py
comdev/nearby_people/nearby/views.py
comdev/nearby_people/templates/people.html
Modified: comdev/nearby_people/nearby/foaf.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/foaf.py?rev=954015&r1=954014&r2=954015&view=diff
==============================================================================
--- comdev/nearby_people/nearby/foaf.py (original)
+++ comdev/nearby_people/nearby/foaf.py Sat Jun 12 14:46:04 2010
@@ -48,10 +48,17 @@ class FOAF(object):
# If we have more than half the requested number of rows
# are under 1000km, then ditch the others
+ km500 = 500 * 1000.0
km1000 = 1000 * 1000.0
+ km2000 = 2000 * 1000.0
if len(dists) and dists[(rows/2)][0] <= km1000:
dists = [d for d in dists if d[0] <= km1000]
+ # If we have any results of under 500km, then skip anyone who's
+ # more than 2000km away
+ if len(dists) and dists[0][0] <= km500:
+ dists = [d for d in dists if d[0] <= km2000]
+
return dists[:rows]
def ensure_data(self):
Modified: comdev/nearby_people/nearby/views.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/views.py?rev=954015&r1=954014&r2=954015&view=diff
==============================================================================
--- comdev/nearby_people/nearby/views.py (original)
+++ comdev/nearby_people/nearby/views.py Sat Jun 12 14:46:04 2010
@@ -65,7 +65,7 @@ def pick_place(request):
'country':res.countryCode
})
else:
- message = "We can't work out the locatoin you mean, please check your request."
+ message = "We can't work out the location you mean, sorry. Please double check your spelling, or try searching for a nearby place which is larger."
else:
form = PlaceForm()
form.set_type( request.GET.get("type","") )
@@ -108,11 +108,18 @@ def retrieve_people_data(form):
center_lat = (min_lat+max_lat)/2
center_long = (min_long+max_long)/2
+ # Decide if we need to say sorry about the distances
+ large_distance = False
+ if len(people) > 0 and people[0][0] > 250*1000:
+ large_distance = True
+
+ # Render!
data = {
'location': search_data, 'people':people,
'center_lat': center_lat, 'center_long': center_long,
'bl_lat': min_lat, 'bl_long': min_long,
'tr_lat': max_lat, 'tr_long': max_long,
+ 'large_distance': large_distance,
}
return data
Modified: comdev/nearby_people/templates/people.html
URL: http://svn.apache.org/viewvc/comdev/nearby_people/templates/people.html?rev=954015&r1=954014&r2=954015&view=diff
==============================================================================
--- comdev/nearby_people/templates/people.html (original)
+++ comdev/nearby_people/templates/people.html Sat Jun 12 14:46:04 2010
@@ -110,6 +110,12 @@ function showDetail(uid) {
{% block content %}
{% if people %}
+ {% if large_distance %}
+ <p>Sorry, there isn't anyone all that near to you. Below is a
+ list of people you may wish to visit when travelling futher
+ afield.</p>
+ {% endif %}
+
<table id="people">
{% for dist, person in people %}
<tr>
@@ -124,6 +130,8 @@ function showDetail(uid) {
{% else %}
<p>Sorry, there's no-one near you :(</p>
<p>Maybe <a href="/pick_place/">try somewhere else?</a></p>
+ <p><i>Why not try searching for people near where you may be visiting
+ when on holiday, or next time you're travelling for work?</i></p>
{% endif %}
{% endblock %}