Check for blank values on import and omit them (#1266)
* Check for blank values on import and omit them * Add paused status to the pirep changed
This commit is contained in:
parent
78d3c6b577
commit
88a8ffe48a
@ -170,6 +170,11 @@ class ImportExport
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($split_values as $value) {
|
foreach ($split_values as $value) {
|
||||||
|
$value = trim($value);
|
||||||
|
if ($value === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// This isn't in the query string format, so it's
|
// This isn't in the query string format, so it's
|
||||||
// just a straight key-value pair set
|
// just a straight key-value pair set
|
||||||
if (strpos($value, '?') === false) {
|
if (strpos($value, '?') === false) {
|
||||||
|
@ -44,6 +44,7 @@ class PirepStatusChanged extends Notification implements ShouldQueue
|
|||||||
PirepStatus::LANDED => 'has landed',
|
PirepStatus::LANDED => 'has landed',
|
||||||
PirepStatus::ARRIVED => 'has arrived',
|
PirepStatus::ARRIVED => 'has arrived',
|
||||||
PirepStatus::CANCELLED => 'is cancelled',
|
PirepStatus::CANCELLED => 'is cancelled',
|
||||||
|
PirepStatus::PAUSED => 'is paused',
|
||||||
PirepStatus::EMERG_DESCENT => 'in emergency descent',
|
PirepStatus::EMERG_DESCENT => 'in emergency descent',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -212,6 +212,11 @@ class FlightImporter extends ImportExport
|
|||||||
$count = 0;
|
$count = 0;
|
||||||
$subfleets = $this->parseMultiColumnValues($col);
|
$subfleets = $this->parseMultiColumnValues($col);
|
||||||
foreach ($subfleets as $subfleet_type) {
|
foreach ($subfleets as $subfleet_type) {
|
||||||
|
$subfleet_type = trim($subfleet_type);
|
||||||
|
if (empty($subfleet_type)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$subfleet = Subfleet::firstOrCreate(
|
$subfleet = Subfleet::firstOrCreate(
|
||||||
['type' => $subfleet_type],
|
['type' => $subfleet_type],
|
||||||
['name' => $subfleet_type]
|
['name' => $subfleet_type]
|
||||||
|
@ -149,6 +149,13 @@ class ImporterTest extends TestCase
|
|||||||
'Arrival Gate' => 'C61',
|
'Arrival Gate' => 'C61',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
// Blank values omitted
|
||||||
|
[
|
||||||
|
'input' => 'gate; ',
|
||||||
|
'expected' => [
|
||||||
|
'gate',
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($tests as $test) {
|
foreach ($tests as $test) {
|
||||||
|
Loading…
Reference in New Issue
Block a user