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->string('source_name', 25)->nullable();
|
||||
$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_on_time')->nullable();
|
||||
$table->timestamps();
|
||||
|
@ -173,7 +173,7 @@ class PirepController extends Controller
|
||||
$attrs['user_id'] = $user->id;
|
||||
$attrs['source'] = PirepSource::ACARS;
|
||||
$attrs['state'] = PirepState::IN_PROGRESS;
|
||||
$attrs['status'] = PirepStatus::PREFILE;
|
||||
$attrs['status'] = PirepStatus::INITIATED;
|
||||
|
||||
$pirep = new Pirep($attrs);
|
||||
|
||||
@ -290,7 +290,7 @@ class PirepController extends Controller
|
||||
}
|
||||
|
||||
$attrs['state'] = PirepState::PENDING;
|
||||
$attrs['status'] = PirepStatus::ARRIVED;
|
||||
$attrs['status'] = PirepStatus::LANDED;
|
||||
|
||||
try {
|
||||
$pirep = $this->pirepRepo->update($attrs, $id);
|
||||
@ -395,7 +395,7 @@ class PirepController extends Controller
|
||||
}
|
||||
|
||||
# Change the PIREP status
|
||||
$pirep->status = PirepStatus::ENROUTE;
|
||||
$pirep->status = PirepStatus::AIRBORNE;
|
||||
$pirep->save();
|
||||
|
||||
return $this->message($count.' positions added', $count);
|
||||
|
@ -5,21 +5,41 @@ namespace App\Models\Enums;
|
||||
use App\Interfaces\Enum;
|
||||
|
||||
/**
|
||||
* Tied to the ACARS statuses/states
|
||||
* Class PirepStatus
|
||||
* Tied to the ACARS statuses/states.
|
||||
* Corresponds to values from AIDX
|
||||
* @package App\Models\Enums
|
||||
*/
|
||||
class PirepStatus extends Enum
|
||||
{
|
||||
public const PREFILE = 0;
|
||||
public const SCHEDULED = 0;
|
||||
public const ENROUTE = 1;
|
||||
public const ARRIVED = 2;
|
||||
public const INITIATED = 'INI';
|
||||
public const SCHEDULED = 'SCH';
|
||||
public const BOARDING = 'BST';
|
||||
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 = [
|
||||
PirepStatus::PREFILE => 'Prefiled',
|
||||
PirepStatus::SCHEDULED => 'Scheduled',
|
||||
PirepStatus::ENROUTE => 'Enroute',
|
||||
PirepStatus::ARRIVED => 'Arrived',
|
||||
PirepStatus::INITIATED => 'Initiated',
|
||||
PirepStatus::SCHEDULED => 'Scheduled',
|
||||
PirepStatus::BOARDING => 'Boarding',
|
||||
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',
|
||||
'source' => 'integer',
|
||||
'state' => 'integer',
|
||||
'status' => 'integer',
|
||||
'block_off_time' => 'datetime',
|
||||
'block_on_time' => 'datetime',
|
||||
];
|
||||
|
@ -308,7 +308,7 @@ class AcarsTest extends TestCase
|
||||
# Check the PIREP state and status
|
||||
$pirep = $this->getPirep($pirep_id);
|
||||
$this->assertEquals(PirepState::IN_PROGRESS, $pirep['state']);
|
||||
$this->assertEquals(PirepStatus::PREFILE, $pirep['status']);
|
||||
$this->assertEquals(PirepStatus::INITIATED, $pirep['status']);
|
||||
|
||||
/**
|
||||
* Check the fields
|
||||
@ -367,7 +367,7 @@ class AcarsTest extends TestCase
|
||||
# Make sure PIREP state moved into ENROUTE
|
||||
$pirep = $this->getPirep($pirep_id);
|
||||
$this->assertEquals(PirepState::IN_PROGRESS, $pirep['state']);
|
||||
$this->assertEquals(PirepStatus::ENROUTE, $pirep['status']);
|
||||
$this->assertEquals(PirepStatus::AIRBORNE, $pirep['status']);
|
||||
|
||||
$response = $this->get($uri);
|
||||
$response->assertStatus(200);
|
||||
|
Loading…
Reference in New Issue
Block a user