Add setting to include transfer hours in calculations (#350)

* Add setting to include transfer hours in calculations

* Add some extra tests to check versions

* A couple of more version test cases
This commit is contained in:
Nabeel S
2019-08-08 12:50:43 -04:00
committed by GitHub
parent ff6ba4c29a
commit a08c9db284
12 changed files with 169 additions and 83 deletions

View File

@@ -17,8 +17,8 @@ use App\Repositories\AircraftRepository;
use App\Repositories\SubfleetRepository;
use App\Support\Units\Time;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use function is_array;
use Log;
/**
* Class UserService
@@ -258,7 +258,12 @@ class UserService extends Service
return $user;
}
$pilot_hours = new Time($user->flight_time);
// If we should count their transfer hours?
if (setting('pilots.count_transfer_hours') === true) {
$pilot_hours = new Time($user->flight_time + $user->transfer_time);
} else {
$pilot_hours = new Time($user->flight_time);
}
// The current rank's hours are over the pilot's current hours,
// so assume that they were "placed" here by an admin so don't