Fix column headers

This commit is contained in:
Nabeel Shahzad
2018-03-30 20:57:30 -05:00
parent 70e5ccda6f
commit 217da07007
5 changed files with 8 additions and 3 deletions

View File

@@ -318,6 +318,7 @@ flights:
level: 360
dpt_time: 6PM CST
arr_time: 11PM EST
flight_time: 240
flight_type: J
created_at: NOW
updated_at: NOW
@@ -329,6 +330,7 @@ flights:
arr_airport_id: LGRP
dpt_time: 9AM CST
arr_time: 1030AM CST
flight_time: 30
flight_type: J
route: PITZZ4 MNURE WLEEE4
created_at: NOW
@@ -340,6 +342,7 @@ flights:
route_leg: 1
dpt_airport_id: EGLL
arr_airport_id: KJFK
flight_time: 480
flight_type: J
dpt_time: 9AM CST
arr_time: 1030AM CST

View File

@@ -20,6 +20,9 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
* @property Collection fares
* @property Collection subfleets
* @property integer days
* @property Airport dep_airport
* @property Airport arr_airport
* @property Airport alt_airport
* @property string dpt_airport_id
* @property string arr_airport_id
* @property string alt_airport_id

View File

@@ -53,7 +53,7 @@ class ExportService extends Service
$writer = $this->openCsv($path);
// Write out the header first
$writer->insertOne(array_keys($exporter->getColumns()));
$writer->insertOne($exporter->getColumns());
// Write the rest of the rows
foreach ($collection as $row) {

View File

@@ -4,7 +4,6 @@ namespace App\Services\ImportExport;
use App\Interfaces\ImportExport;
use App\Models\Enums\Days;
use App\Models\Enums\FlightType;
use App\Models\Flight;
/**
@@ -47,7 +46,6 @@ class FlightExporter extends ImportExport
}
$ret['days'] = $this->getDays($flight);
#$ret['flight_type'] = FlightType::convertToCode($ret['flight_type']);
$ret['fares'] = $this->getFares($flight);
$ret['fields'] = $this->getFields($flight);

View File

@@ -301,6 +301,7 @@ class ImporterTest extends TestCase
$this->assertEquals('27', $exported['days']);
$this->assertEquals('VMS', $exported['airline']);
$this->assertEquals($flight->flight_time, $exported['flight_time']);
$this->assertEquals('J', $exported['flight_type']);
$this->assertEquals('A32X;B74X', $exported['subfleets']);
$this->assertEquals('Y?capacity=100;F', $exported['fares']);