Skip to content

Commit

Permalink
Fixed distance display to deal with missing results
Browse files Browse the repository at this point in the history
  • Loading branch information
reekypete committed Nov 26, 2015
1 parent 74ebf93 commit 257ece1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js/google_geocoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ function callBacker(selector) {
// outputDiv.innerHTML = '';
// origins[i] + ' to ' + destinations[j]
var results = response.rows[0].elements;
outputDiv.html(', or via roads: '
+ results[0].distance.text.split(' ').join(' ') + ' in '
+ results[0].duration.text.split(' ').join(' ') + ' cycling');
if (results[0].status === "ZERO_RESULTS"){
// zip
}
else{
outputDiv.html('Via roads: '
+ results[0].distance.text.split(' ').join(' ') + ' in '
+ results[0].duration.text.split(' ').join(' ') + ' cycling');
}
}
};

Expand Down

0 comments on commit 257ece1

Please sign in to comment.