Skip to content

Commit

Permalink
Fix Diversion Handling (#1902)
Browse files Browse the repository at this point in the history
We need to check correct setting (and preferably we should name it in a more human readable form in the code)
  • Loading branch information
FatihKoz authored Dec 2, 2024
1 parent 2a2602f commit a696cd1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/Services/PirepService.php
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,10 @@ public function handleDiversion(Pirep $pirep): void
$has_vmsacars = Module::find('VMSAcars');

if ($has_vmsacars && $flight) {
$free_flights_enabled = DB::table('vmsacars_config')->find('free_flights_airline_aircraft_only')?->value;
$free_flights_disabled = DB::table('vmsacars_config')->find('disable_free_flights')?->value;
// Log::debug('vmsAcars | Disable Free Flights Setting: '.$free_flights_disabled.', considered as '.get_truth_state($free_flights_disabled));

if (get_truth_state($free_flights_enabled) === false) {
if (get_truth_state($free_flights_disabled) == true) {
// Lookup for flights from diversion airport to original destination airport
$reposition_flights_count = $this->flightRepo->where([
'dpt_airport_id' => $diversion_airport->id,
Expand Down Expand Up @@ -801,7 +802,9 @@ public function handleDiversion(Pirep $pirep): void

$reposition_flight->subfleets()->syncWithoutDetaching([$aircraft->subfleet_id]);

Log::info('Divertion repositioning flight '.$reposition_flight->id.' from '.$diversion_airport->id.' to '.$pirep->arr_airport_id.' created');
Log::info('Diversion repositioning flight '.$reposition_flight->id.' from '.$diversion_airport->id.' to '.$pirep->arr_airport_id.' created');
} else {
Log::info('Diversion repositioning flight NOT created, '.$reposition_flights_count.' flights found between '.$diversion_airport->id.' and '.$pirep->arr_airport_id);
}
}
}
Expand Down

0 comments on commit a696cd1

Please sign in to comment.