Skip to content

Commit

Permalink
Merge pull request #171 from CodeforAustralia/Distance-missing-results
Browse files Browse the repository at this point in the history
Fixed distance display to deal with missing results
  • Loading branch information
Lilith-Palmer committed Nov 29, 2015
2 parents 4815c93 + 257ece1 commit 6108274
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 6108274

Please sign in to comment.