datenspuren food: ensure a minimum amount of pois

This commit is contained in:
Astro 2015-09-21 21:40:34 +02:00
parent ca1d78f1c6
commit af302e61e6
1 changed files with 3 additions and 2 deletions

View File

@ -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) {