Set a default model value for airports on PIREP (#500)

* Set a default model value for airports on PIREP

* Fix airport icao reference

* Default airport models
This commit is contained in:
Nabeel S
2020-01-15 13:00:58 -05:00
committed by GitHub
parent de8046288b
commit 831b72fb2b
4 changed files with 36 additions and 31 deletions

View File

@@ -231,23 +231,13 @@ class GeoService extends Service
]);
}*/
// If there is a position update from ACARS, show where it is
// Otherwise, just assume it's at the arrival airport currently
if ($pirep->position) {
$position = [
'lat' => $pirep->position->lat,
'lon' => $pirep->position->lon,
];
} else {
// if arrived, show it being at the arrival airport
$position = [
'lat' => $pirep->arr_airport->lat,
'lon' => $pirep->arr_airport->lon,
];
}
return [
'position' => $position,
// If there is a position update from ACARS, show where it is
// Otherwise, just assume it's at the arrival airport currently
'position' => [
'lat' => optional($pirep->position)->lat ?? $pirep->arr_airport->lat,
'lon' => optional($pirep->position)->lon ?? $pirep->arr_airport->lon,
],
'line' => $route->getLine(),
'points' => $route->getPoints(),
'airports' => [