From d4871490b8a235d67183bcf95804dabbda29e43e Mon Sep 17 00:00:00 2001 From: Matt Harris Date: Sat, 21 Mar 2015 01:15:40 -0700 Subject: [PATCH] More debugging, let's see if the maps are fixed now. --- routes/package.js | 16 ++++++++++------ views/map.handlebars | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/routes/package.js b/routes/package.js index 1badf74..1551a66 100644 --- a/routes/package.js +++ b/routes/package.js @@ -150,17 +150,21 @@ router.get('/map', auth.ensureAuthenticated, function(req, res) { if (err) { res.render('500', {error: err}); } else { + var packages = {}; for(var package in data) { if (data[package].currentLocation) { - data[package].location = { - latitude: data[package].currentLocation.geoInfo[0].latitude, - longitude: data[package].currentLocation.geoInfo[0].longitude + packages[package] = { + _id: data[package]._id, + description: data[package].description, + location: { + latitude: data[package].currentLocation.geoInfo[0].latitude, + longitude: data[package].currentLocation.geoInfo[0].longitude + } }; - } else { - data.splice(package, 1); } } - res.render('map', {packages: data, mapsApiKey: credentials.apiKeys.googleMaps}); + console.log(packages); + res.render('map', {packages: packages, mapsApiKey: credentials.apiKeys.googleMaps}); } }); }); diff --git a/views/map.handlebars b/views/map.handlebars index ba6dd22..86acba4 100644 --- a/views/map.handlebars +++ b/views/map.handlebars @@ -32,6 +32,7 @@ map: map, title: packages[packageId].description }); + console.log("Added " + packages[packageId].description); } }