Default values for automatically added airports #829 (#878)

This commit is contained in:
Yash Govekar
2020-10-21 00:55:13 +05:30
committed by GitHub
parent c0514b381b
commit 716ba38b6d
6 changed files with 57 additions and 12 deletions

View File

@@ -45,8 +45,20 @@ class AirportImporter extends ImportExport
$row['id'] = $row['icao'];
$row['hub'] = get_truth_state($row['hub']);
if ($row['ground_handling_cost'] === null && $row['ground_handling_cost'] !== 0.0) {
$row['ground_handling_cost'] = (float) setting('airports.default_ground_handling_cost');
} else {
$row['ground_handling_cost'] = (float) $row['ground_handling_cost'];
}
if ($row['fuel_jeta_cost'] === null && $row['fuel_jeta_cost'] !== 0.0) {
$row['fuel_jeta_cost'] = (float) setting('airports.default_jet_a_fuel_cost');
} else {
$row['fuel_jeta_cost'] = (float) $row['fuel_jeta_cost'];
}
try {
$airport = Airport::updateOrCreate([
Airport::updateOrCreate([
'id' => $row['icao'],
], $row);
} catch (\Exception $e) {