Skip to content

Commit

Permalink
Fixed bug in recommendation system
Browse files Browse the repository at this point in the history
  • Loading branch information
wozuo committed Dec 17, 2017
1 parent 8513936 commit 7583307
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions controllers/recommendationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ RecommendationController.prototype = (function() {
for(var i = 0; i < items.length; i++) {
console.log('Item Location: ' + items[i].location);
console.log('Item Event Time: ' + items[i].start.dateTime);
dateTimes.push(items[i].start.dateTime);
url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' + items[i].location + '&key=' + process.env.GOOGLE_MAPS_API_KEY + '';
coordinatePromises.push(getRequest(url));
if(items[i].location !== undefined) {
dateTimes.push(items[i].start.dateTime);
url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' + items[i].location + '&key=' + process.env.GOOGLE_MAPS_API_KEY + '';
coordinatePromises.push(getRequest(url));
}
}
Promise.all(coordinatePromises).then((results) => {
let coordinates = [];
Expand Down

0 comments on commit 7583307

Please sign in to comment.