Fix For Load Factor and Variance Bug (#1002)

PR fixes the issue where load factor and variance being reported 0 to simbrief form, where user does not provide any values for each and wants to use general settings per flight.

Quick fix for issue #1001
This commit is contained in:
B.Fatih KOZ 2021-01-22 16:14:34 +03:00 committed by GitHub
parent 7e9196c7e6
commit f5ca8ce6e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,9 +3,11 @@
@section('content')
@php
$loadmin = $flight->load_factor - $flight->load_factor_variance;
$loadmax = $flight->load_factor + $flight->load_factor_variance;
if($loadmin < 1) { $loadmin = 1; }
if($flight->load_factor) { $lfactor = $flight->load_factor ;} else { $lfactor = setting('flights.default_load_factor') ;}
if($flight->load_factor_variance) { $lfactorv = $flight->load_factor_variance ;} else { $lfactorv = setting('flights.load_factor_variance') ;}
$loadmin = $lfactor - $lfactorv ;
$loadmax = $lfactor + $lfactorv ;
if($loadmin < 0) { $loadmin = 0; }
if($loadmax > 100) { $loadmax = 100; }
@endphp