datenspuren food: ensure a minimum amount of pois
This commit is contained in:
parent
ca1d78f1c6
commit
af302e61e6
|
@ -93,11 +93,12 @@ h3.click(function() {
|
|||
success: function(json) {
|
||||
var pois = json.elements.map(function(info) {
|
||||
return new POI(info)
|
||||
}).filter(function(poi) {
|
||||
return poi.getDistance() <= 1000
|
||||
}).sort(function(a, b) {
|
||||
return a.getDistance() - b.getDistance()
|
||||
})
|
||||
while(pois.length > 20 && pois[pois.length - 1].getDistance() > 1000) {
|
||||
pois.pop()
|
||||
}
|
||||
|
||||
var dl = $('<dl id="food"></dl>')
|
||||
pois.forEach(function(poi) {
|
||||
|
|
Loading…
Reference in New Issue