@@ -267,6 +267,9 @@ class Pirep extends Model
|
|||||||
$upper_bound = $this->planned_distance;
|
$upper_bound = $this->planned_distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$upper_bound = empty($upper_bound) ? 1 : $upper_bound;
|
||||||
|
$distance = empty($distance) ? $upper_bound : $distance;
|
||||||
|
|
||||||
return round(($distance / $upper_bound) * 100, 0);
|
return round(($distance / $upper_bound) * 100, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,11 +231,23 @@ class GeoService extends Service
|
|||||||
]);
|
]);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
return [
|
// If there is a position update from ACARS, show where it is
|
||||||
'position' => [
|
// Otherwise, just assume it's at the arrival airport currently
|
||||||
|
if ($pirep->position) {
|
||||||
|
$position = [
|
||||||
'lat' => $pirep->position->lat,
|
'lat' => $pirep->position->lat,
|
||||||
'lon' => $pirep->position->lon,
|
'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,
|
||||||
'line' => $route->getLine(),
|
'line' => $route->getLine(),
|
||||||
'points' => $route->getPoints(),
|
'points' => $route->getPoints(),
|
||||||
'airports' => [
|
'airports' => [
|
||||||
|
|||||||
Reference in New Issue
Block a user