From 16c977c769c2212a82282ed948b2ee0f78a733fd Mon Sep 17 00:00:00 2001 From: Nabeel S Date: Thu, 5 Mar 2020 20:19:12 -0500 Subject: [PATCH] Add load_factor and load_factor_variance to flights #352 (#620) --- app/Database/factories/FlightFactory.php | 30 +++++----- ...0_03_05_141152_flights_add_load_factor.php | 37 +++++++++++++ app/Database/seeds/dev/sample.yml | 52 +++++++++++++++--- app/Database/seeds/settings.yml | 14 +++++ app/Http/Resources/Flight.php | 13 ++++- app/Models/Flight.php | 44 +++++++++------ app/Services/ImportExport/ExpenseImporter.php | 1 + app/Services/ImportExport/FlightImporter.php | 42 +++++++------- app/helpers.php | 14 +++++ config/phpvms.php | 7 ++- .../Resources/views/step1-configure.blade.php | 2 +- .../Providers/AppServiceProvider.php | 3 +- .../views/admin/dashboard/index.blade.php | 2 +- resources/views/admin/flights/fares.blade.php | 3 +- .../views/admin/flights/fields.blade.php | 55 ++++++++++++++----- .../views/admin/maintenance/cron.blade.php | 2 +- .../views/admin/subfleets/fields.blade.php | 5 +- tests/FinanceTest.php | 4 +- tests/FlightTest.php | 23 ++++++-- tests/MetarTest.php | 6 +- tests/TestCase.php | 3 +- tests/data/expenses.csv | 18 +++--- tests/data/expenses_empty_rows.csv | 18 +++--- tests/data/flights.csv | 8 +-- tests/data/flights_empty_fields.csv | 4 +- 25 files changed, 290 insertions(+), 120 deletions(-) create mode 100644 app/Database/migrations/2020_03_05_141152_flights_add_load_factor.php diff --git a/app/Database/factories/FlightFactory.php b/app/Database/factories/FlightFactory.php index d6d0cac7..3d117dd3 100644 --- a/app/Database/factories/FlightFactory.php +++ b/app/Database/factories/FlightFactory.php @@ -22,20 +22,22 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) { 'alt_airport_id' => function () { return factory(App\Models\Airport::class)->create()->id; }, - 'distance' => $faker->numberBetween(1, 1000), - 'route' => null, - 'level' => 0, - 'dpt_time' => $faker->time(), - 'arr_time' => $faker->time(), - 'flight_time' => $faker->numberBetween(60, 360), - 'has_bid' => false, - 'active' => true, - 'visible' => true, - 'days' => 0, - 'start_date' => null, - 'end_date' => null, - 'created_at' => $faker->dateTimeBetween('-1 week', 'now'), - 'updated_at' => static function (array $flight) { + 'distance' => $faker->numberBetween(1, 1000), + 'route' => null, + 'level' => 0, + 'dpt_time' => $faker->time(), + 'arr_time' => $faker->time(), + 'flight_time' => $faker->numberBetween(60, 360), + 'load_factor' => $faker->randomElement([15, 20, 50, 90, 100]), + 'load_factor_variance' => $faker->randomElement([15, 20, 50, 90, 100]), + 'has_bid' => false, + 'active' => true, + 'visible' => true, + 'days' => 0, + 'start_date' => null, + 'end_date' => null, + 'created_at' => $faker->dateTimeBetween('-1 week', 'now'), + 'updated_at' => static function (array $flight) { return $flight['created_at']; }, ]; diff --git a/app/Database/migrations/2020_03_05_141152_flights_add_load_factor.php b/app/Database/migrations/2020_03_05_141152_flights_add_load_factor.php new file mode 100644 index 00000000..67ea5240 --- /dev/null +++ b/app/Database/migrations/2020_03_05_141152_flights_add_load_factor.php @@ -0,0 +1,37 @@ +decimal('load_factor', 5, 2) + ->nullable() + ->after('flight_type'); + + $table->decimal('load_factor_variance', 5, 2) + ->nullable() + ->after('load_factor'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('flights', function (Blueprint $table) { + $table->dropColumn('load_factor'); + $table->dropColumn('load_factor_variance'); + }); + } +} diff --git a/app/Database/seeds/dev/sample.yml b/app/Database/seeds/dev/sample.yml index 4af24ff5..14898d15 100644 --- a/app/Database/seeds/dev/sample.yml +++ b/app/Database/seeds/dev/sample.yml @@ -124,7 +124,16 @@ airports: lat: 25.2528 lon: 55.3644 ground_handling_cost: 50 - + - id: OMAA + iata: AUH + icao: OMAA + name: Abu Dhabi International Airport + location: Abu Dhabi + country: + timezone: Asia/Dubai + lat: 24.433 + lon: 54.6511 + ground_handling_cost: 50 # aircraft: - id: 1 @@ -283,6 +292,7 @@ flights: arr_time: 11PM EST flight_time: 240 flight_type: J + load_factor: 100 created_at: NOW updated_at: NOW - id: flightid_3 @@ -294,6 +304,7 @@ flights: arr_airport_id: KJFK flight_time: 480 flight_type: J + load_factor: 63 dpt_time: 9AM CST arr_time: 1030AM CST route: PITZZ4 MNURE WLEEE4 @@ -308,6 +319,37 @@ flights: arr_airport_id: MWCR flight_time: 70 flight_type: 'J' + load_factor: 80 + dpt_time: '0800' + arr_time: '0900' + route: 'MLY5 KEMBO UG442 SIA UG633 OTEKO UR640 NALRO GUBEL3' + created_at: NOW + updated_at: NOW + - id: flightid_5 + airline_id: 1 + flight_number: 112 + route_code: + route_leg: + dpt_airport_id: OMAA + arr_airport_id: OMDB + flight_time: 30 + flight_type: 'J' + load_factor: + dpt_time: '0800' + arr_time: '0900' + route: 'MLY5 KEMBO UG442 SIA UG633 OTEKO UR640 NALRO GUBEL3' + created_at: NOW + updated_at: NOW + - id: flightid_6 + airline_id: 1 + flight_number: 113 + route_code: + route_leg: + dpt_airport_id: OMDB + arr_airport_id: OMAA + flight_time: 30 + flight_type: 'J' + load_factor: 100 dpt_time: '0800' arr_time: '0900' route: 'MLY5 KEMBO UG442 SIA UG633 OTEKO UR640 NALRO GUBEL3' @@ -467,12 +509,8 @@ pirep_fares: pirep_fields: - id: 1 - name: departure terminal - slug: departure-terminal - required: 1 - - id: 2 - name: arrival terminal - slug: arrival-terminal + name: Cost Index + slug: cost-index required: 0 pirep_field_values: diff --git a/app/Database/seeds/settings.yml b/app/Database/seeds/settings.yml index 5067b4d2..e5a8ee20 100644 --- a/app/Database/seeds/settings.yml +++ b/app/Database/seeds/settings.yml @@ -138,6 +138,20 @@ options: '' type: int description: 'Number of hours to expire bids after' +- key: flights.default_load_factor + name: 'Load Factor' + group: flights + value: 82 + options: '' + type: number + description: 'The default load factor for a flight, as a percent' +- key: flights.load_factor_variance + name: 'Load Factor Variance' + group: flights + value: 5 + options: '' + type: number + description: 'How much the load factor can vary per-flight' - key: pireps.duplicate_check_time name: 'PIREP duplicate time check' group: pireps diff --git a/app/Http/Resources/Flight.php b/app/Http/Resources/Flight.php index 684e9e42..a9181767 100644 --- a/app/Http/Resources/Flight.php +++ b/app/Http/Resources/Flight.php @@ -5,12 +5,13 @@ namespace App\Http\Resources; use App\Support\Units\Distance; use stdClass; +/** + * @mixin \App\Models\Flight + */ class Flight extends Response { /** * Set the fields on the flight object - * - * @mixin \App\Models\Flight */ private function setFields() { @@ -42,6 +43,14 @@ class Flight extends Response $res['ident'] = $this->ident; + if (empty($res['load_factor'])) { + $res['load_factor'] = setting('flights.default_load_factor'); + } + + if (empty($res['load_factor_variance'])) { + $res['load_factor_variance'] = setting('flights.load_factor_variance'); + } + $distance = new Distance($res['distance'], config('phpvms.internal_units.distance')); $res['distance'] = $distance->getResponseUnits(); diff --git a/app/Models/Flight.php b/app/Models/Flight.php index 58cc517c..0f4530f9 100644 --- a/app/Models/Flight.php +++ b/app/Models/Flight.php @@ -26,6 +26,8 @@ use Illuminate\Support\Collection; * @property int flight_time * @property string route * @property int level + * @property float load_factor + * @property float load_factor_variance * @property Airport dpt_airport * @property Airport arr_airport * @property Airport alt_airport @@ -65,6 +67,8 @@ class Flight extends Model 'distance', 'flight_time', 'flight_type', + 'load_factor', + 'load_factor_variance', 'route', 'notes', 'start_date', @@ -75,27 +79,31 @@ class Flight extends Model ]; protected $casts = [ - 'flight_number' => 'integer', - 'days' => 'integer', - 'level' => 'integer', - 'distance' => 'float', - 'flight_time' => 'integer', - 'start_date' => 'date', - 'end_date' => 'date', - 'has_bid' => 'boolean', - 'route_leg' => 'integer', - 'active' => 'boolean', - 'visible' => 'boolean', + 'flight_number' => 'integer', + 'days' => 'integer', + 'level' => 'integer', + 'distance' => 'float', + 'flight_time' => 'integer', + 'start_date' => 'date', + 'end_date' => 'date', + 'load_factor' => 'double', + 'load_factor_variance' => 'double', + 'has_bid' => 'boolean', + 'route_leg' => 'integer', + 'active' => 'boolean', + 'visible' => 'boolean', ]; public static $rules = [ - 'airline_id' => 'required|exists:airlines,id', - 'flight_number' => 'required', - 'route_code' => 'nullable', - 'route_leg' => 'nullable', - 'dpt_airport_id' => 'required|exists:airports,id', - 'arr_airport_id' => 'required|exists:airports,id', - 'level' => 'nullable', + 'airline_id' => 'required|exists:airlines,id', + 'flight_number' => 'required', + 'route_code' => 'nullable', + 'route_leg' => 'nullable', + 'dpt_airport_id' => 'required|exists:airports,id', + 'arr_airport_id' => 'required|exists:airports,id', + 'load_factor' => 'nullable|numeric', + 'load_factor_variance' => 'nullable|numeric', + 'level' => 'nullable', ]; /** diff --git a/app/Services/ImportExport/ExpenseImporter.php b/app/Services/ImportExport/ExpenseImporter.php index ef619fea..7b0df07a 100644 --- a/app/Services/ImportExport/ExpenseImporter.php +++ b/app/Services/ImportExport/ExpenseImporter.php @@ -25,6 +25,7 @@ class ExpenseImporter extends ImportExport 'name' => 'required', 'amount' => 'required|numeric', 'type' => 'required', + 'flight_type' => 'nullable', 'charge_to_user' => 'nullable|boolean', 'multiplier' => 'nullable|numeric', 'active' => 'nullable|boolean', diff --git a/app/Services/ImportExport/FlightImporter.php b/app/Services/ImportExport/FlightImporter.php index e9813748..c76d2793 100644 --- a/app/Services/ImportExport/FlightImporter.php +++ b/app/Services/ImportExport/FlightImporter.php @@ -25,26 +25,28 @@ class FlightImporter extends ImportExport * Should match the database fields, for the most part */ public static $columns = [ - 'airline' => 'required', - 'flight_number' => 'required', - 'route_code' => 'nullable', - 'route_leg' => 'nullable', - 'dpt_airport' => 'required', - 'arr_airport' => 'required', - 'alt_airport' => 'nullable', - 'days' => 'nullable', - 'dpt_time' => 'nullable', - 'arr_time' => 'nullable', - 'level' => 'nullable|integer', - 'distance' => 'nullable|numeric', - 'flight_time' => 'required|integer', - 'flight_type' => 'required|alpha', - 'route' => 'nullable', - 'notes' => 'nullable', - 'active' => 'nullable|boolean', - 'subfleets' => 'nullable', - 'fares' => 'nullable', - 'fields' => 'nullable', + 'airline' => 'required', + 'flight_number' => 'required', + 'route_code' => 'nullable', + 'route_leg' => 'nullable', + 'dpt_airport' => 'required', + 'arr_airport' => 'required', + 'alt_airport' => 'nullable', + 'days' => 'nullable', + 'dpt_time' => 'nullable', + 'arr_time' => 'nullable', + 'level' => 'nullable|integer', + 'distance' => 'nullable|numeric', + 'flight_time' => 'required|integer', + 'flight_type' => 'required|alpha', + 'load_factor' => 'nullable', + 'load_factor_variance' => 'nullable', + 'route' => 'nullable', + 'notes' => 'nullable', + 'active' => 'nullable|boolean', + 'subfleets' => 'nullable', + 'fares' => 'nullable', + 'fields' => 'nullable', ]; private $airportSvc; diff --git a/app/helpers.php b/app/helpers.php index 97858dac..a0e97622 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -307,3 +307,17 @@ if (!function_exists('_fmt')) { return $line; } } + +if (!function_exists('docs_link')) { + /** + * Return a link to the docs + * + * @param string $key Key from phpvms.config.docs + * + * @return string + */ + function docs_link($key) + { + return config('phpvms.docs.root').config('phpvms.docs.'.$key); + } +} diff --git a/config/phpvms.php b/config/phpvms.php index 44590162..757e056b 100644 --- a/config/phpvms.php +++ b/config/phpvms.php @@ -109,6 +109,11 @@ return [ * The links to various docs on the documentation site */ 'docs' => [ - 'cron' => 'http://docs.phpvms.net/configuration/cron', + 'root' => 'http://docs.phpvms.net', + 'cron' => '/configuration/cron', + 'finances' => '/concepts/finances', + 'importing_legacy' => '/setup/importing-from-v2-v5', + 'load_factor' => '/operations/flights#load-factor', + 'subfleets' => '/concepts/basics#subfleets-and-aircraft', ], ]; diff --git a/modules/Importer/Resources/views/step1-configure.blade.php b/modules/Importer/Resources/views/step1-configure.blade.php index 845805e4..82e5dde0 100644 --- a/modules/Importer/Resources/views/step1-configure.blade.php +++ b/modules/Importer/Resources/views/step1-configure.blade.php @@ -12,7 +12,7 @@
  • The first user's password (admin) will be "admin". Please change it after logging in
  • User passwords will be reset and they will need to use "Forgot Password" to reset it
  • If you have more than 1000 PIREPs or flights, it's best to use the command-line importer! - Click here to + Click here to see the documentation of how to use it.
  • THIS WILL WIPE OUT YOUR EXISTING DATA - this is required to make sure that things like diff --git a/modules/Vacentral/Providers/AppServiceProvider.php b/modules/Vacentral/Providers/AppServiceProvider.php index 7a77920e..85684c35 100644 --- a/modules/Vacentral/Providers/AppServiceProvider.php +++ b/modules/Vacentral/Providers/AppServiceProvider.php @@ -28,7 +28,8 @@ class AppServiceProvider extends ServiceProvider ], 'config'); $this->mergeConfigFrom( - __DIR__.'/../Config/config.php', 'vacentral' + __DIR__.'/../Config/config.php', + 'vacentral' ); } } diff --git a/resources/views/admin/dashboard/index.blade.php b/resources/views/admin/dashboard/index.blade.php index f370bc9a..ee6afc4f 100644 --- a/resources/views/admin/dashboard/index.blade.php +++ b/resources/views/admin/dashboard/index.blade.php @@ -6,7 +6,7 @@ @endif diff --git a/resources/views/admin/flights/fares.blade.php b/resources/views/admin/flights/fares.blade.php index 1f3cc9f2..e72b01db 100644 --- a/resources/views/admin/flights/fares.blade.php +++ b/resources/views/admin/flights/fares.blade.php @@ -6,8 +6,7 @@ the values used come from the subfleet of the aircraft that the flight is filed with. Only assign the fares you want to override. They can be set as a monetary amount, or a percentage. - Read documentation about finances. + Read documentation about finances. @endcomponent

    {{ $errors->first('value') }}

    diff --git a/resources/views/admin/flights/fields.blade.php b/resources/views/admin/flights/fields.blade.php index 59ffdfb6..870cbca3 100644 --- a/resources/views/admin/flights/fields.blade.php +++ b/resources/views/admin/flights/fields.blade.php @@ -99,25 +99,28 @@ {{-- NEXT ROW --}}
    -
    - {{ Form::label('dpt_time', 'Departure Time:') }} - {{ Form::text('dpt_time', null, ['class' => 'form-control']) }} -

    {{ $errors->first('dpt_time') }}

    +
    + {{ Form::label('load_factor', 'Load Factor:') }} + {{ Form::text('load_factor', null, ['class' => 'form-control']) }} +

    {{ $errors->first('load_factor') }}

    + @component('admin.components.info') + Value between 1 and 100. See + docs. + Leave blank to use the default value. + @endcomponent
    -
    - {{ Form::label('arr_time', 'Arrival Time:') }} - {{ Form::text('arr_time', null, ['class' => 'form-control']) }} -

    {{ $errors->first('arr_time') }}

    +
    + {{ Form::label('load_factor_variance', 'Load Factor Variance:') }} + {{ Form::text('load_factor_variance', null, ['class' => 'form-control']) }} +

    {{ $errors->first('load_factor_variance') }}

    + @component('admin.components.info') + How much the load factor can vary per flight (+ or -). Leave blank to + use the default value. + @endcomponent
    -
    - {{ Form::label('level', 'Flight Level:') }} - {{ Form::text('level', null, ['class' => 'form-control']) }} -

    {{ $errors->first('level') }}

    -
    - -
    +
    {{ Form::label('distance', 'Distance:') }} in nautical miles Calculate {{ Form::text('distance', null, ['id' => 'distance', 'class' => 'form-control']) }} @@ -185,6 +188,20 @@
    + +
    +
    + {{ Form::label('dpt_time', 'Departure Time:') }} + {{ Form::text('dpt_time', null, ['class' => 'form-control']) }} +

    {{ $errors->first('dpt_time') }}

    +
    + +
    + {{ Form::label('arr_time', 'Arrival Time:') }} + {{ Form::text('arr_time', null, ['class' => 'form-control']) }} +

    {{ $errors->first('arr_time') }}

    +
    +
    @@ -206,6 +223,14 @@

    {{ $errors->first('route') }}

    + +
    +
    + {{ Form::label('level', 'Flight Level:') }} + {{ Form::text('level', null, ['class' => 'form-control']) }} +

    {{ $errors->first('level') }}

    +
    +
    diff --git a/resources/views/admin/maintenance/cron.blade.php b/resources/views/admin/maintenance/cron.blade.php index 2e540cc6..1244fdfb 100644 --- a/resources/views/admin/maintenance/cron.blade.php +++ b/resources/views/admin/maintenance/cron.blade.php @@ -15,7 +15,7 @@ @endif diff --git a/resources/views/admin/subfleets/fields.blade.php b/resources/views/admin/subfleets/fields.blade.php index 0a635b8c..2aaace6c 100644 --- a/resources/views/admin/subfleets/fields.blade.php +++ b/resources/views/admin/subfleets/fields.blade.php @@ -5,10 +5,7 @@ group aircraft together by feature, so 737s with winglets might have a type of "B.738-WL". You can create as many as you want, you need at least one, though. - Read more about subfleets here. - + Read more about subfleets here. @endcomponent diff --git a/tests/FinanceTest.php b/tests/FinanceTest.php index 0d200625..68e52518 100644 --- a/tests/FinanceTest.php +++ b/tests/FinanceTest.php @@ -435,7 +435,9 @@ class FinanceTest extends TestCase // Change to a percentage $manual_pay_rate = '50%'; $manual_pay_adjusted = Math::addPercent( - $rank->manual_base_pay_rate, $manual_pay_rate); + $rank->manual_base_pay_rate, + $manual_pay_rate + ); $this->fleetSvc->addSubfleetToRank($subfleet['subfleet'], $rank, [ 'manual_pay' => $manual_pay_rate, diff --git a/tests/FlightTest.php b/tests/FlightTest.php index e61ce6e5..2f805834 100644 --- a/tests/FlightTest.php +++ b/tests/FlightTest.php @@ -27,15 +27,18 @@ class FlightTest extends TestCase /** * Add a single flight * - * @param $user + * @param $user + * @param array $flight_properties * * @return mixed */ - public function addFlight($user) + public function addFlight($user, $flight_properties = []) { - $flight = factory(App\Models\Flight::class)->create([ + $opts = array_merge([ 'airline_id' => $user->airline_id, - ]); + ], $flight_properties); + + $flight = factory(App\Models\Flight::class)->create($opts); $flight->subfleets()->syncWithoutDetaching([ factory(App\Models\Subfleet::class)->create([ @@ -119,7 +122,10 @@ class FlightTest extends TestCase public function testGetFlight() { $this->user = factory(App\Models\User::class)->create(); - $flight = $this->addFlight($this->user); + $flight = $this->addFlight($this->user, [ + 'load_factor' => '', + 'load_factor_variance' => '', + ]); $req = $this->get('/api/flights/'.$flight->id); $req->assertStatus(200); @@ -128,6 +134,7 @@ class FlightTest extends TestCase $this->assertEquals($flight->id, $body['id']); $this->assertEquals($flight->dpt_airport_id, $body['dpt_airport_id']); $this->assertEquals($flight->arr_airport_id, $body['arr_airport_id']); + $this->assertEquals(setting('flights.default_load_factor'), $body['load_factor']); // Distance conversion $this->assertHasKeys($body['distance'], ['mi', 'nmi', 'km']); @@ -167,6 +174,12 @@ class FlightTest extends TestCase $flight->route = $route_text; $flight->save(); + $req = $this->get('/api/flights/'.$flight->id); + $req->assertStatus(200); + + $body = $req->json()['data']; + $this->assertEquals($flight->load_factor, $body['load_factor']); + $res = $this->get('/api/flights/'.$flight->id.'/route'); $res->assertStatus(200); $body = $res->json(); diff --git a/tests/MetarTest.php b/tests/MetarTest.php index 82f577a5..317baa2b 100644 --- a/tests/MetarTest.php +++ b/tests/MetarTest.php @@ -27,7 +27,8 @@ class MetarTest extends TestCase private function mockXmlResponse($filename) { $mock = new MockHandler([ - new Response(200, + new Response( + 200, [ 'Content-Type' => 'text/xml', ], @@ -85,7 +86,8 @@ class MetarTest extends TestCase $this->assertCount(4, $parsed['clouds']); $this->assertEquals( 'A few at 1676 meters; scattered at 2896 meters; broken sky at 3353 meters; broken sky at 7010 meters', - $parsed['clouds_report']); + $parsed['clouds_report'] + ); $this->assertEquals(1676.4, $parsed['cloud_height']['m']); $this->assertEquals(false, $parsed['cavok']); diff --git a/tests/TestCase.php b/tests/TestCase.php index 14be075c..8e69d5b5 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -135,7 +135,8 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase public function mockGuzzleClient($mockFile): void { $mock = new MockHandler([ - new Response(200, + new Response( + 200, [ 'Content-Type' => 'application/json; charset=utf-8', ], diff --git a/tests/data/expenses.csv b/tests/data/expenses.csv index 64ea6d94..8f584693 100644 --- a/tests/data/expenses.csv +++ b/tests/data/expenses.csv @@ -1,9 +1,9 @@ -airline,name,amount,type,charge_to_user,multiplier,active,ref_model,ref_model_id -,"Per-Flight (no muliplier)",100,F,0,0,1,, -,"Per-Flight (multiplier)",100,F,0,1,1,, -VMS,"Per-Flight (multiplier, on airline)",200,F,0,1,1,, -,"A daily fee",800,D,0,0,1,, -,"A monthly fee",5000,M,0,0,1,, -,Catering,1000,F,0,0,1,Subfleet,744-3X-RB211 -,"Catering Staff",1000,D,0,0,1,Subfleet,744-3X-RB211 -,Maintenance,1000,D,0,0,1,App\Models\Aircraft,001Z +airline,name,amount,type,flight_type,charge_to_user,multiplier,active,ref_model,ref_model_id +,"Per-Flight (no muliplier)",100,F,,0,0,1,, +,"Per-Flight (multiplier)",100,F,,0,1,1,, +VMS,"Per-Flight (multiplier, on airline)",200,F,,0,1,1,, +,"A daily fee",800,D,,0,0,1,, +,"A monthly fee",5000,M,,0,0,1,, +,Catering,1000,F,J,0,0,1,Subfleet,744-3X-RB211 +,"Catering Staff",1000,D,J,0,0,1,Subfleet,744-3X-RB211 +,Maintenance,1000,D,F,0,0,1,App\Models\Aircraft,001Z diff --git a/tests/data/expenses_empty_rows.csv b/tests/data/expenses_empty_rows.csv index da4b1e17..c762f833 100644 --- a/tests/data/expenses_empty_rows.csv +++ b/tests/data/expenses_empty_rows.csv @@ -1,11 +1,11 @@ -airline,name,amount,type,charge_to_user,multiplier,active,ref_model,ref_model_id -,"Per-Flight (no muliplier)",100,F,0,0,1,, -,"Per-Flight (multiplier)",100,F,0,1,1,, -VMS,"Per-Flight (multiplier, on airline)",200,F,0,1,1,, -,"A daily fee",800,D,0,0,1,, -,"A monthly fee",5000,M,0,0,1,, -,Catering,1000,F,0,0,1,Subfleet,744-3X-RB211 -,"Catering Staff",1000,D,0,0,1,Subfleet,744-3X-RB211 -,Maintenance,1000,D,0,0,1,App\Models\Aircraft,001Z +airline,name,amount,type,flight_type,charge_to_user,multiplier,active,ref_model,ref_model_id +,"Per-Flight (no muliplier)",100,F,,0,0,1,, +,"Per-Flight (multiplier)",100,F,,0,1,1,, +VMS,"Per-Flight (multiplier, on airline)",200,F,,0,1,1,, +,"A daily fee",800,D,,0,0,1,, +,"A monthly fee",5000,M,,0,0,1,, +,Catering,1000,F,,0,0,1,Subfleet,744-3X-RB211 +,"Catering Staff",1000,D,,0,0,1,Subfleet,744-3X-RB211 +,Maintenance,1000,D,,0,0,1,App\Models\Aircraft,001Z diff --git a/tests/data/flights.csv b/tests/data/flights.csv index 5210eb51..397c11c8 100644 --- a/tests/data/flights.csv +++ b/tests/data/flights.csv @@ -1,4 +1,4 @@ -airline,flight_number,route_code,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,route,notes,active,subfleets,fares,fields -VMS,1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41 -" ",1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41 -VMS,113,,,KJFK,KAUS,KDFW,15,0810 EST,1035 CST,350,,207,J,,"Empty distance",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=C41;Arrival Gate=2 +airline,flight_number,route_code,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,load_factor, load_factor_variance,route,notes,active,subfleets,fares,fields +VMS,1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,85,0, ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41 +" ",1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,100,10, ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41 +VMS,113,,,KJFK,KAUS,KDFW,15,0810 EST,1035 CST,350,,207,J,70,2,,"Empty distance",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=C41;Arrival Gate=2 diff --git a/tests/data/flights_empty_fields.csv b/tests/data/flights_empty_fields.csv index df70414a..ac33faf5 100644 --- a/tests/data/flights_empty_fields.csv +++ b/tests/data/flights_empty_fields.csv @@ -1,2 +1,2 @@ -airline,flight_number,route_code,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,route,notes,active,subfleets,fares,fields -VMS,1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?, +airline,flight_number,route_code,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,load_factor, load_factor_variance,route,notes,active,subfleets,fares,fields +VMS,1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,,,ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,