Move loadmin/max into the controller (#1003)

This commit is contained in:
Nabeel S
2021-01-22 09:02:15 -05:00
committed by GitHub
parent fb0027b140
commit 101b3261f5
2 changed files with 12 additions and 9 deletions

View File

@@ -100,12 +100,24 @@ class SimBriefController
]);
}
// Get the correct load factors
$lfactor = $flight->load_factor ?? setting('flights.default_load_factor');
$lfactorv = $flight->load_factor_variance ?? setting('flights.load_factor_variance');
$loadmin = $lfactor - $lfactorv;
$loadmin = $loadmin < 0 ? 0 : $loadmin;
$loadmax = $lfactor + $lfactorv;
$loadmax = $loadmax > 100 ? 100 : $loadmax;
// Show the main simbrief form
return view('flights.simbrief_form', [
'flight' => $flight,
'aircraft' => $aircraft,
'subfleets' => $subfleets,
'pax_weight' => $pax_weight,
'loadmin' => $loadmin,
'loadmax' => $loadmax,
]);
}