Add load_factor and load_factor_variance to flights #352 (#620)

This commit is contained in:
Nabeel S
2020-03-05 20:19:12 -05:00
committed by GitHub
parent 9ed2e3f9f4
commit 16c977c769
25 changed files with 290 additions and 120 deletions

View File

@@ -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'];
},
];

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class FlightsAddLoadFactor extends Migration
{
/**
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
*/
public function up()
{
Schema::table('flights', function (Blueprint $table) {
$table->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');
});
}
}

View File

@@ -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:

View File

@@ -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