This commit is contained in:
Yash 2022-11-12 17:54:23 +05:30
parent a74f0c2af0
commit f405d04ce1

View File

@ -116,13 +116,6 @@ class FlightImporter extends ImportExport
$flight->setAttribute('flight_type', $flight_type); $flight->setAttribute('flight_type', $flight_type);
$flight->setAttribute('active', get_truth_state($row['active'])); $flight->setAttribute('active', get_truth_state($row['active']));
try {
$flight->save();
} catch (\Exception $e) {
$this->errorLog('Error in row '.$index.': '.$e->getMessage());
return false;
}
// Create/check that they exist // Create/check that they exist
$process_dep = $this->processAirport($row['dpt_airport']); $process_dep = $this->processAirport($row['dpt_airport']);
if (is_null($process_dep)) { if (is_null($process_dep)) {
@ -142,6 +135,13 @@ class FlightImporter extends ImportExport
} }
} }
try {
$flight->save();
} catch (\Exception $e) {
$this->errorLog('Error in row '.$index.': '.$e->getMessage());
return false;
}
// Check/calculate the distance // Check/calculate the distance
if (empty($row['distance'])) { if (empty($row['distance'])) {
$row['distance'] = $this->airportSvc->calculateDistance( $row['distance'] = $this->airportSvc->calculateDistance(