Route sorting
This commit is contained in:
@@ -107,7 +107,7 @@ class AcarsController extends Controller
|
|||||||
return new AcarsRouteResource(Acars::where([
|
return new AcarsRouteResource(Acars::where([
|
||||||
'pirep_id' => $id,
|
'pirep_id' => $id,
|
||||||
'type' => AcarsType::FLIGHT_PATH
|
'type' => AcarsType::FLIGHT_PATH
|
||||||
])->orderBy('created_at', 'asc')->get());
|
])->orderBy('sim_time', 'asc')->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -402,14 +402,16 @@ class Pirep extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(Acars::class, 'pirep_id')
|
return $this->hasMany(Acars::class, 'pirep_id')
|
||||||
->where('type', AcarsType::FLIGHT_PATH)
|
->where('type', AcarsType::FLIGHT_PATH)
|
||||||
->orderBy('created_at', 'desc');
|
->orderBy('created_at', 'asc')
|
||||||
|
->orderBy('sim_time', 'asc');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function acars_logs()
|
public function acars_logs()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Acars::class, 'pirep_id')
|
return $this->hasMany(Acars::class, 'pirep_id')
|
||||||
->where('type', AcarsType::LOG)
|
->where('type', AcarsType::LOG)
|
||||||
->orderBy('created_at', 'desc');
|
->orderBy('created_at', 'desc')
|
||||||
|
->orderBy('sim_time', 'asc');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function acars_route()
|
public function acars_route()
|
||||||
|
|||||||
@@ -197,15 +197,24 @@ class GeoService extends Service
|
|||||||
|
|
||||||
$route = new GeoJson();
|
$route = new GeoJson();
|
||||||
|
|
||||||
|
$actual_route = $this->acarsRepo->forPirep($pirep->id, AcarsType::FLIGHT_PATH);
|
||||||
|
foreach ($actual_route as $point) {
|
||||||
|
$route->addPoint($point->lat, $point->lon, [
|
||||||
|
'pirep_id' => $pirep->id,
|
||||||
|
'alt' => $point->altitude,
|
||||||
|
//'popup' => 'GS: '.$point->gs.'<br />Alt: '.$point->altitude,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var $point \App\Models\Acars
|
* @var $point \App\Models\Acars
|
||||||
*/
|
*/
|
||||||
foreach ($pirep->acars as $point) {
|
/*foreach ($pirep->acars as $point) {
|
||||||
$route->addPoint($point->lat, $point->lon, [
|
$route->addPoint($point->lat, $point->lon, [
|
||||||
'pirep_id' => $pirep->id,
|
'pirep_id' => $pirep->id,
|
||||||
'alt' => $point->altitude,
|
'alt' => $point->altitude,
|
||||||
]);
|
]);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'position' => [
|
'position' => [
|
||||||
|
|||||||
Reference in New Issue
Block a user