diff --git a/app/Database/seeds/dev/sample.yml b/app/Database/seeds/dev/sample.yml index 14898d15..c47a6418 100644 --- a/app/Database/seeds/dev/sample.yml +++ b/app/Database/seeds/dev/sample.yml @@ -141,24 +141,28 @@ aircraft: airport_id: KJFK name: Boeing 747-438 registration: 001Z + flight_time: 360 status: A - id: 2 subfleet_id: 2 airport_id: LGRP name: Boeing 777-200 registration: C202 + flight_time: 260 status: A - id: 3 subfleet_id: 1 airport_id: KAUS name: Boeing 747-412 registration: S2333 + flight_time: 0 status: A - id: 4 subfleet_id: 1 airport_id: KAUS name: Boeing 747-436 RETIRED registration: + flight_time: 45 status: R expenses: diff --git a/app/Models/Aircraft.php b/app/Models/Aircraft.php index bbfbe300..faff4311 100644 --- a/app/Models/Aircraft.php +++ b/app/Models/Aircraft.php @@ -38,6 +38,7 @@ class Aircraft extends Model 'name', 'registration', 'hex_code', + 'flight_time', 'zfw', 'status', 'state', @@ -49,6 +50,7 @@ class Aircraft extends Model protected $casts = [ 'subfleet_id' => 'integer', 'zfw' => 'float', + 'flight_time' => 'float', 'state' => 'integer', ]; diff --git a/resources/views/admin/aircraft/table.blade.php b/resources/views/admin/aircraft/table.blade.php index b329c227..83634f7e 100644 --- a/resources/views/admin/aircraft/table.blade.php +++ b/resources/views/admin/aircraft/table.blade.php @@ -24,7 +24,7 @@ {{ $ac->airport_id }} - @minutestotime($ac->flight_hours) + @minutestotime($ac->flight_time) @if($ac->status == \App\Models\Enums\AircraftStatus::ACTIVE) diff --git a/tests/PIREPTest.php b/tests/PIREPTest.php index 03d4124a..dd379803 100644 --- a/tests/PIREPTest.php +++ b/tests/PIREPTest.php @@ -225,6 +225,9 @@ class PIREPTest extends TestCase 'flight_time' => 360, ]); + $aircraft = Aircraft::find(1); + $flight_time_initial = $aircraft->flight_time; + foreach ($pireps as $pirep) { $this->pirepSvc->create($pirep); $this->pirepSvc->accept($pirep); @@ -236,9 +239,12 @@ class PIREPTest extends TestCase // Make sure rank went up $this->assertGreaterThan($user->rank_id, $pilot->rank_id); $this->assertEquals($last_pirep->arr_airport_id, $pilot->curr_airport_id); - $this->assertEquals(2, $pilot->flights); + $aircraft = Aircraft::find(1); + $after_time = $flight_time_initial + 720; + $this->assertEquals($after_time, $aircraft->flight_time); + // // Submit another PIREP, adding another 6 hours // it should automatically be accepted