diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index d49007e2..51f3bfb6 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -117,7 +117,8 @@ class ImportService extends Service // turn it into a collection and run some filtering $row = collect($row)->map(function ($val, $index) { - return trim($val); + $val = trim($val); + return empty($val) ? null : $val; })->toArray(); // Try to validate diff --git a/tests/ImporterTest.php b/tests/ImporterTest.php index 6484668f..e1c6fe5c 100644 --- a/tests/ImporterTest.php +++ b/tests/ImporterTest.php @@ -652,8 +652,8 @@ class ImporterTest extends TestCase $this->assertEquals(true, $airport->hub); $this->assertEquals('30.1945', $airport->lat); $this->assertEquals('-97.6699', $airport->lon); - $this->assertEquals(0.0, $airport->ground_handling_cost); - $this->assertEquals(setting('airports.default_jet_a_fuel_cost'), $airport->fuel_jeta_cost); + $this->assertEquals(250, $airport->ground_handling_cost); + $this->assertEquals(0.8, $airport->fuel_jeta_cost); // should be updated // See if it imported $airport = Airport::where([ diff --git a/tests/data/airports.csv b/tests/data/airports.csv index 4990410f..135b797a 100644 --- a/tests/data/airports.csv +++ b/tests/data/airports.csv @@ -1,4 +1,4 @@ -icao,iata,name,location,country,timezone,hub,lat,lon,ground_handling_cost,fuel_100ll_cost,fuel_jeta_cost,fuel_mogas_cost -KAUS,AUS,Austin-Bergstrom,"Austin, Texas, USA", United States,America/Chicago,1,30.1945,-97.6699,0,,, -KSFO,SFO,San Francisco,"San Francisco, California, USA", United States,America/California,1,30.1945,-97.6699,,,0.9, -KJFK,JFK,Kennedy,"Queens, New York, USA", United States,America/New_York,0,30.1945,abcd,150,,0.8, +icao,iata,name,location,country,timezone,hub,lat,lon,ground_handling_cost,fuel_100ll_cost,fuel_jeta_cost,fuel_mogas_cost +KAUS,AUS,Austin-Bergstrom,"Austin, Texas, USA", United States,America/Chicago,1,30.1945,-97.6699,250,0.8,0.8,0.8 +KSFO,SFO,San Francisco,"San Francisco, California, USA", United States,America/California,1,30.1945,-97.6699,,,0.9, +KJFK,JFK,Kennedy,"Queens, New York, USA", United States,America/New_York,0,30.1945,abcd,150,,0.8,