Skip to content

Commit

Permalink
Fix airline mapping for aircraft #628 (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelio committed Mar 9, 2020
1 parent 412919f commit 2a03d53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions app/Models/Observers/AircraftObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
use App\Models\Aircraft;
use App\Support\ICAO;

/**
* Class AircraftObserver
*/
class AircraftObserver
{
/**
Expand All @@ -17,6 +14,10 @@ class AircraftObserver
*/
public function creating(Aircraft $aircraft): void
{
if (!empty($aircraft->airport_id)) {
$aircraft->airport_id = strtoupper($aircraft->airport_id);
}

if (empty($aircraft->hex_code)) {
$aircraft->hex_code = ICAO::createHexCode();
}
Expand Down
2 changes: 1 addition & 1 deletion modules/Importer/Services/Importers/AircraftImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function run($start = 0)
foreach ($rows as $row) {
$airline_id = null;
if (!empty($row->airline)) {
$airline_id = $this->idMapper->getMapping('airlines', $row->airline_id);
$airline_id = $this->idMapper->getMapping('airlines', $row->airline);
}

$subfleet = $this->getSubfleet($row->icao, $airline_id);
Expand Down

0 comments on commit 2a03d53

Please sign in to comment.