Browse Source

better error check for geocoding

pull/31/head
Aaron Parecki 5 years ago
parent
commit
3c77290a0a
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      compass/app/Jobs/TripComplete.php

+ 3
- 3
compass/app/Jobs/TripComplete.php View File

@ -37,7 +37,7 @@ class TripComplete extends Job implements SelfHandling, ShouldQueue
// Don't run the web hooks for manually created trips
if(isset($this->_data['properties']['end_location'])) {
$urls = preg_split('/\s+/', $db->ping_urls);
// Build a trip object that looks like the active trip format from Overland
$trip = [
'trip' => [
@ -133,7 +133,7 @@ class TripComplete extends Job implements SelfHandling, ShouldQueue
];
Log::info('Looking up start location');
$start = self::geocode($startAdr['properties']['latitude'], $startAdr['properties']['longitude']);
if($start) {
if($start && property_exists($start, 'locality')) {
$startAdr['properties']['locality'] = $start->locality;
$startAdr['properties']['region'] = $start->region;
$startAdr['properties']['country'] = $start->country;
@ -154,7 +154,7 @@ class TripComplete extends Job implements SelfHandling, ShouldQueue
];
Log::info('Looking up end location');
$end = self::geocode($endAdr['properties']['latitude'], $endAdr['properties']['longitude']);
if($end) {
if($end && property_exists($end, 'locality')) {
$endAdr['properties']['locality'] = $end->locality;
$endAdr['properties']['region'] = $end->region;
$endAdr['properties']['country'] = $end->country;

Loading…
Cancel
Save