Expand flight types to match IATA SSIM

This commit is contained in:
Nabeel Shahzad 2018-03-29 11:34:36 -05:00
parent ec553f06c8
commit b31384f429
7 changed files with 53 additions and 14093 deletions

View File

@ -547,11 +547,11 @@ class Importer
# Set the flight type
$row->flighttype = strtoupper($row->flighttype);
if ($row->flighttype === 'P') {
$attrs['flight_type'] = FlightType::PASSENGER;
$attrs['flight_type'] = FlightType::SCHED_PAX;
} elseif ($row->flighttype === 'C') {
$attrs['flight_type'] = FlightType::CARGO;
$attrs['flight_type'] = FlightType::SCHED_CARGO;
} else {
$attrs['flight_type'] = FlightType::CHARTER;
$attrs['flight_type'] = FlightType::CHARTER_PAX_ONLY;
}
# Set the flight level of the PIREP is set

View File

@ -28,7 +28,7 @@ class CreateFlightTables extends Migration
$table->unsignedInteger('level')->nullable()->default(0);
$table->unsignedDecimal('distance')->nullable()->default(0.0);
$table->unsignedInteger('flight_time')->nullable();
$table->tinyInteger('flight_type')->default(FlightType::PASSENGER);
$table->char('flight_type', 1)->default(FlightType::SCHED_PAX);
$table->text('route')->nullable();
$table->text('notes')->nullable();
$table->boolean('has_bid')->default(false);

View File

@ -38,7 +38,7 @@ class CreatePirepTables extends Migration
$table->text('notes')->nullable();
$table->unsignedTinyInteger('source')->nullable()->default(0);
$table->string('source_name', 25)->nullable();
$table->tinyInteger('flight_type')->default(FlightType::PASSENGER);
$table->tinyInteger('flight_type')->default(FlightType::SCHED_PAX);
$table->tinyInteger('state')->default(PirepState::PENDING);
$table->tinyInteger('status')->default(PirepStatus::SCHEDULED);
$table->timestamps();

View File

@ -315,6 +315,7 @@ flights:
level: 360
dpt_time: 6PM CST
arr_time: 11PM EST
flight_type: J
created_at: NOW
updated_at: NOW
- id: flightid_2
@ -325,6 +326,7 @@ flights:
arr_airport_id: LGRP
dpt_time: 9AM CST
arr_time: 1030AM CST
flight_type: J
route: PITZZ4 MNURE WLEEE4
created_at: NOW
updated_at: NOW
@ -335,6 +337,7 @@ flights:
route_leg: 1
dpt_airport_id: EGLL
arr_airport_id: KJFK
flight_type: J
dpt_time: 9AM CST
arr_time: 1030AM CST
route: PITZZ4 MNURE WLEEE4

View File

@ -10,19 +10,54 @@ use App\Interfaces\Enum;
*/
class FlightType extends Enum
{
public const PASSENGER = 0;
public const CARGO = 1;
public const CHARTER = 2;
public const SCHED_PAX = 'J';
public const SCHED_CARGO = 'F';
public const CHARTER_PAX_ONLY = 'C';
public const ADDITIONAL_CARGO = 'A';
public const VIP = 'E';
public const ADDTL_PAX = 'G';
public const CHARTER_CARGO_MAIL = 'H';
public const AMBULANCE = 'I';
public const TRAINING = 'K';
public const MAIL_SERVICE = 'M';
public const CHARTER_SPECIAL = 'O';
public const POSITIONING = 'P';
public const TECHNICAL_TEST = 'T';
public const MILITARY = 'W';
public const TECHNICAL_STOP = 'X';
protected static $labels = [
FlightType::PASSENGER => 'Passenger',
FlightType::CARGO => 'Cargo',
FlightType::CHARTER => 'Charter',
FlightType::SCHED_PAX => 'Passenger - Scheduled',
FlightType::SCHED_CARGO => 'Cargo - Scheduled',
FlightType::CHARTER_PAX_ONLY => 'Charter - Passenger Only',
FlightType::ADDITIONAL_CARGO => 'Additional Cargo/Mail',
FlightType::VIP => 'Special VIP Flight (FAA/Government)',
FlightType::ADDTL_PAX => 'Passenger - Additional',
FlightType::CHARTER_CARGO_MAIL => 'Passenger - Additional',
FlightType::AMBULANCE => 'Ambulance Flight',
FlightType::TRAINING => 'Training Flight',
FlightType::MAIL_SERVICE => 'Mail Service',
FlightType::CHARTER_SPECIAL => 'Charter reqs Special Handling',
FlightType::POSITIONING => 'Positioning (Ferry/Delivery/Demo)',
FlightType::TECHNICAL_TEST => 'Technical Test',
FlightType::MILITARY => 'Military',
FlightType::TECHNICAL_STOP => 'Technical Stop',
];
protected static $codes = [
FlightType::PASSENGER => 'P',
FlightType::CARGO => 'C',
FlightType::CHARTER => 'H',
FlightType::SCHED_PAX => 'J',
FlightType::SCHED_CARGO => 'F',
FlightType::CHARTER_PAX_ONLY => 'C',
FlightType::ADDITIONAL_CARGO => 'A',
FlightType::VIP => 'E',
FlightType::ADDTL_PAX => 'G',
FlightType::CHARTER_CARGO_MAIL => 'H',
FlightType::AMBULANCE => 'I',
FlightType::TRAINING => 'K',
FlightType::MAIL_SERVICE => 'M',
FlightType::CHARTER_SPECIAL => 'O',
FlightType::TECHNICAL_TEST => 'T',
FlightType::MILITARY => 'M',
FlightType::TECHNICAL_STOP => 'X',
];
}

14078
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -376,7 +376,7 @@ class ImporterTest extends TestCase
$this->assertEquals('350', $flight->level);
$this->assertEquals('1477', $flight->distance);
$this->assertEquals('207', $flight->flight_time);
$this->assertEquals(FlightType::PASSENGER, $flight->flight_type);
$this->assertEquals(FlightType::SCHED_PAX, $flight->flight_type);
$this->assertEquals('ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6', $flight->route);
$this->assertEquals('Just a flight', $flight->notes);
$this->assertEquals(true, $flight->active);