Add addtl fields to pirep - block_off and block_on times, calculate block_off time if not there
This commit is contained in:
@@ -39,13 +39,18 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) {
|
||||
'zfw' => $faker->randomFloat(2),
|
||||
'block_fuel' => $faker->randomFloat(2, 0, 30000),
|
||||
'fuel_used' => $faker->randomFloat(2, 0, 30000),
|
||||
'block_on_time' => Carbon::now('UTC'),
|
||||
'block_off_time' => function (array $pirep) {
|
||||
return $pirep['block_on_time']->subMinutes($pirep['flight_time']);
|
||||
},
|
||||
'route' => $faker->text(200),
|
||||
'notes' => $faker->text(200),
|
||||
'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]),
|
||||
'source_name' => 'Test Factory',
|
||||
'state' => PirepState::PENDING,
|
||||
'status' => PirepStatus::SCHEDULED,
|
||||
'created_at' => Carbon::now()->toDateTimeString(),
|
||||
'submitted_at' => Carbon::now('UTC')->toDateTimeString(),
|
||||
'created_at' => Carbon::now('UTC')->toDateTimeString(),
|
||||
'updated_at' => function (array $pirep) {
|
||||
return $pirep['created_at'];
|
||||
},
|
||||
|
||||
@@ -39,9 +39,10 @@ class CreatePirepTables extends Migration
|
||||
$table->text('route')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->unsignedTinyInteger('source')->nullable()->default(0);
|
||||
$table->string('source_name', 25)->nullable();
|
||||
$table->string('source_name', 50)->nullable();
|
||||
$table->tinyInteger('state')->default(PirepState::PENDING);
|
||||
$table->char('status', 3)->default(PirepStatus::SCHEDULED);
|
||||
$table->dateTime('submitted_at')->nullable();
|
||||
$table->dateTime('block_off_time')->nullable();
|
||||
$table->dateTime('block_on_time')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
@@ -386,6 +386,8 @@ pireps:
|
||||
aircraft_id: 1
|
||||
dpt_airport_id: KAUS
|
||||
arr_airport_id: KJFK
|
||||
block_off_time: 2018-04-04T12:42:36+00:00
|
||||
block_on_time: 2018-04-04T16:42:36+00:00
|
||||
flight_time: 180 # 6 hours
|
||||
state: 1 # accepted
|
||||
status: 0
|
||||
@@ -393,8 +395,9 @@ pireps:
|
||||
flight_type: J
|
||||
route: KAUS SID TNV J87 IAH J2 LCH J22 MEI J239 ATL J52 AJFEB J14 BYJAC Q60 JAXSN J14 COLIN J61 HUBBS J55 SIE STAR KJFK
|
||||
notes: just a pilot report
|
||||
created_at: NOW
|
||||
updated_at: NOW
|
||||
submitted_at: 2018-04-04T16:50:36+00:00
|
||||
created_at: 2018-04-04T16:50:36+00:00
|
||||
updated_at: 2018-04-04T17:00:36+00:00
|
||||
- id: pirepid_2
|
||||
user_id: 1
|
||||
airline_id: 1
|
||||
@@ -409,6 +412,7 @@ pireps:
|
||||
notes: just a pilot report
|
||||
source: 1 # pending
|
||||
source_name: sample
|
||||
submitted_at: NOW
|
||||
created_at: NOW
|
||||
updated_at: NOW
|
||||
- id: pirepid_3
|
||||
@@ -424,6 +428,7 @@ pireps:
|
||||
flight_type: J
|
||||
route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
|
||||
notes: just a pilot report
|
||||
submitted_at: NOW
|
||||
created_at: NOW
|
||||
updated_at: NOW
|
||||
|
||||
|
||||
Reference in New Issue
Block a user