Change PIREP states to follow AIDX guidelines
This commit is contained in:
parent
ee077ffa16
commit
0f521c3af9
@ -41,7 +41,7 @@ class CreatePirepTables extends Migration
|
|||||||
$table->unsignedTinyInteger('source')->nullable()->default(0);
|
$table->unsignedTinyInteger('source')->nullable()->default(0);
|
||||||
$table->string('source_name', 25)->nullable();
|
$table->string('source_name', 25)->nullable();
|
||||||
$table->tinyInteger('state')->default(PirepState::PENDING);
|
$table->tinyInteger('state')->default(PirepState::PENDING);
|
||||||
$table->tinyInteger('status')->default(PirepStatus::SCHEDULED);
|
$table->char('status', 3)->default(PirepStatus::SCHEDULED);
|
||||||
$table->dateTime('block_off_time')->nullable();
|
$table->dateTime('block_off_time')->nullable();
|
||||||
$table->dateTime('block_on_time')->nullable();
|
$table->dateTime('block_on_time')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
@ -173,7 +173,7 @@ class PirepController extends Controller
|
|||||||
$attrs['user_id'] = $user->id;
|
$attrs['user_id'] = $user->id;
|
||||||
$attrs['source'] = PirepSource::ACARS;
|
$attrs['source'] = PirepSource::ACARS;
|
||||||
$attrs['state'] = PirepState::IN_PROGRESS;
|
$attrs['state'] = PirepState::IN_PROGRESS;
|
||||||
$attrs['status'] = PirepStatus::PREFILE;
|
$attrs['status'] = PirepStatus::INITIATED;
|
||||||
|
|
||||||
$pirep = new Pirep($attrs);
|
$pirep = new Pirep($attrs);
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ class PirepController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$attrs['state'] = PirepState::PENDING;
|
$attrs['state'] = PirepState::PENDING;
|
||||||
$attrs['status'] = PirepStatus::ARRIVED;
|
$attrs['status'] = PirepStatus::LANDED;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$pirep = $this->pirepRepo->update($attrs, $id);
|
$pirep = $this->pirepRepo->update($attrs, $id);
|
||||||
@ -395,7 +395,7 @@ class PirepController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Change the PIREP status
|
# Change the PIREP status
|
||||||
$pirep->status = PirepStatus::ENROUTE;
|
$pirep->status = PirepStatus::AIRBORNE;
|
||||||
$pirep->save();
|
$pirep->save();
|
||||||
|
|
||||||
return $this->message($count.' positions added', $count);
|
return $this->message($count.' positions added', $count);
|
||||||
|
@ -5,21 +5,41 @@ namespace App\Models\Enums;
|
|||||||
use App\Interfaces\Enum;
|
use App\Interfaces\Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tied to the ACARS statuses/states
|
* Tied to the ACARS statuses/states.
|
||||||
* Class PirepStatus
|
* Corresponds to values from AIDX
|
||||||
* @package App\Models\Enums
|
* @package App\Models\Enums
|
||||||
*/
|
*/
|
||||||
class PirepStatus extends Enum
|
class PirepStatus extends Enum
|
||||||
{
|
{
|
||||||
public const PREFILE = 0;
|
public const INITIATED = 'INI';
|
||||||
public const SCHEDULED = 0;
|
public const SCHEDULED = 'SCH';
|
||||||
public const ENROUTE = 1;
|
public const BOARDING = 'BST';
|
||||||
public const ARRIVED = 2;
|
public const RDY_START = 'RDT';
|
||||||
|
public const OFF_BLOCK = 'OFB'; // Departed from gate
|
||||||
|
public const RDY_DEICE = 'DIR';
|
||||||
|
public const STRT_DEICE = 'DIC';
|
||||||
|
public const GRND_RTRN = 'GRT';
|
||||||
|
public const AIRBORNE = 'TKO';
|
||||||
|
public const DIVERTED = 'DV';
|
||||||
|
public const APPROACH = 'TEN';
|
||||||
|
public const ON_FINAL = 'FIN';
|
||||||
|
public const LANDED = 'LAN';
|
||||||
|
public const ON_BLOCK = 'ONB'; // Arrived to gate
|
||||||
|
|
||||||
protected static $labels = [
|
protected static $labels = [
|
||||||
PirepStatus::PREFILE => 'Prefiled',
|
PirepStatus::INITIATED => 'Initiated',
|
||||||
PirepStatus::SCHEDULED => 'Scheduled',
|
PirepStatus::SCHEDULED => 'Scheduled',
|
||||||
PirepStatus::ENROUTE => 'Enroute',
|
PirepStatus::BOARDING => 'Boarding',
|
||||||
PirepStatus::ARRIVED => 'Arrived',
|
PirepStatus::RDY_START => 'Ready for start',
|
||||||
|
PirepStatus::OFF_BLOCK => 'Off block',
|
||||||
|
PirepStatus::RDY_DEICE => 'Ready for de-icing',
|
||||||
|
PirepStatus::STRT_DEICE => 'De-icing in progress',
|
||||||
|
PirepStatus::GRND_RTRN => 'Ground return',
|
||||||
|
PirepStatus::AIRBORNE => 'Enroute',
|
||||||
|
PirepStatus::DIVERTED => 'Diverted',
|
||||||
|
PirepStatus::APPROACH => 'Approach',
|
||||||
|
PirepStatus::ON_FINAL => 'Final approach',
|
||||||
|
PirepStatus::LANDED => 'Arrived',
|
||||||
|
PirepStatus::ON_BLOCK => 'On block',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,6 @@ class Pirep extends Model
|
|||||||
'landing_rate' => 'float',
|
'landing_rate' => 'float',
|
||||||
'source' => 'integer',
|
'source' => 'integer',
|
||||||
'state' => 'integer',
|
'state' => 'integer',
|
||||||
'status' => 'integer',
|
|
||||||
'block_off_time' => 'datetime',
|
'block_off_time' => 'datetime',
|
||||||
'block_on_time' => 'datetime',
|
'block_on_time' => 'datetime',
|
||||||
];
|
];
|
||||||
|
@ -308,7 +308,7 @@ class AcarsTest extends TestCase
|
|||||||
# Check the PIREP state and status
|
# Check the PIREP state and status
|
||||||
$pirep = $this->getPirep($pirep_id);
|
$pirep = $this->getPirep($pirep_id);
|
||||||
$this->assertEquals(PirepState::IN_PROGRESS, $pirep['state']);
|
$this->assertEquals(PirepState::IN_PROGRESS, $pirep['state']);
|
||||||
$this->assertEquals(PirepStatus::PREFILE, $pirep['status']);
|
$this->assertEquals(PirepStatus::INITIATED, $pirep['status']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the fields
|
* Check the fields
|
||||||
@ -367,7 +367,7 @@ class AcarsTest extends TestCase
|
|||||||
# Make sure PIREP state moved into ENROUTE
|
# Make sure PIREP state moved into ENROUTE
|
||||||
$pirep = $this->getPirep($pirep_id);
|
$pirep = $this->getPirep($pirep_id);
|
||||||
$this->assertEquals(PirepState::IN_PROGRESS, $pirep['state']);
|
$this->assertEquals(PirepState::IN_PROGRESS, $pirep['state']);
|
||||||
$this->assertEquals(PirepStatus::ENROUTE, $pirep['status']);
|
$this->assertEquals(PirepStatus::AIRBORNE, $pirep['status']);
|
||||||
|
|
||||||
$response = $this->get($uri);
|
$response = $this->get($uri);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
Loading…
Reference in New Issue
Block a user