Fix flight hours field #683 (#684)

This commit is contained in:
Nabeel S 2020-05-05 14:36:14 -04:00 committed by GitHub
parent 9135337186
commit 5b771be653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 2 deletions

View File

@ -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:

View File

@ -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',
];

View File

@ -24,7 +24,7 @@
</td>
<td style="text-align: center;">{{ $ac->airport_id }}</td>
<td style="text-align: center;">
@minutestotime($ac->flight_hours)
@minutestotime($ac->flight_time)
</td>
<td style="text-align: center;">
@if($ac->status == \App\Models\Enums\AircraftStatus::ACTIVE)

View File

@ -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