Account for fuel in the finance calculations #313

This commit is contained in:
Nabeel Shahzad
2019-07-23 08:41:20 -04:00
parent ee1c8ee3fa
commit 62a10224a0
31 changed files with 246 additions and 89 deletions

View File

@@ -48,8 +48,8 @@ $factory->define(App\Models\Airport::class, function (Faker $faker) {
'lon' => $faker->longitude,
'hub' => false,
'ground_handling_cost' => $faker->randomFloat(2, 0, 500),
'fuel_100ll_cost' => $faker->randomFloat(2, 0, 100),
'fuel_jeta_cost' => $faker->randomFloat(2, 0, 100),
'fuel_mogas_cost' => $faker->randomFloat(2, 0, 100),
'fuel_100ll_cost' => $faker->randomFloat(2, 1, 10),
'fuel_jeta_cost' => $faker->randomFloat(2, 1, 10),
'fuel_mogas_cost' => $faker->randomFloat(2, 1, 10),
];
});

View File

@@ -22,7 +22,7 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) {
'alt_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},
'distance' => $faker->numberBetween(0, 1000),
'distance' => $faker->numberBetween(1, 1000),
'route' => null,
'level' => 0,
'dpt_time' => $faker->time(),

View File

@@ -37,8 +37,10 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) {
'flight_time' => $faker->numberBetween(60, 360),
'planned_flight_time' => $faker->numberBetween(60, 360),
'zfw' => $faker->randomFloat(2),
'block_fuel' => $faker->randomFloat(2, 0, 30000),
'fuel_used' => $faker->randomFloat(2, 0, 30000),
'block_fuel' => $faker->randomFloat(2, 0, 1000),
'fuel_used' => function (array $pirep) {
return round($pirep['block_fuel'] * .9, 2); // 90% of the fuel loaded was used
},
'block_on_time' => Carbon::now('UTC'),
'block_off_time' => function (array $pirep) {
return $pirep['block_on_time']->subMinutes($pirep['flight_time']);

View File

@@ -1,5 +1,6 @@
acars:
- pirep_id: pirepid_1
- id: acars_1
pirep_id: pirepid_1
type: 1
nav_type: 2
name: TNV
@@ -7,7 +8,8 @@ acars:
lon: -96.058239
created_at: now
updated_at: now
- pirep_id: pirepid_1
- id: acars_2
pirep_id: pirepid_1
type: 1
nav_type: 2
name: IAH
@@ -15,7 +17,8 @@ acars:
lon: -95.345719
created_at: now
updated_at: now
- pirep_id: pirepid_1
- id: acars_3
pirep_id: pirepid_1
type: 1
nav_type: 2
name: LCH
@@ -23,7 +26,8 @@ acars:
lon: -93.105569
created_at: now
updated_at: now
- pirep_id: pirepid_1
- id: acars_4
pirep_id: pirepid_1
type: 1
nav_type: 2
name: MEI
@@ -31,7 +35,8 @@ acars:
lon: -88.804267
created_at: now
updated_at: now
- pirep_id: pirepid_1
- id: acars_5
pirep_id: pirepid_1
type: 1
nav_type: 2
name: ATL
@@ -39,7 +44,8 @@ acars:
lon: -84.435064
created_at: now
updated_at: now
- pirep_id: pirepid_1
- id: acars_6
pirep_id: pirepid_1
type: 1
nav_type: 2
name: SIE

View File

@@ -3,14 +3,4 @@
# want to modify or erase any of this here
#
airports:
- id: KAUS
iata: AUS
icao: KAUS
name: Austin-Bergstrom
location: Austin, Texas, USA
country: United States
timezone: America/Chicago
lat: 30.1945278
lon: -97.6698889
hub: 1

View File

@@ -452,15 +452,17 @@ pireps:
block_off_time: 2018-04-04T12:42:36+00:00
block_on_time: 2018-04-04T16:42:36+00:00
flight_time: 180 # 6 hours
block_fuel: 20000
fuel_used: 10000
state: 1 # accepted
status: 0
source: 1
flight_type: J
route: KAUS SID TNV J87 IAH J2 LCH J22 MEI J239 ATL J52 AJFEB J14 BYJAC Q60 JAXSN J14 COLIN J61 HUBBS J55 SIE STAR KJFK
notes: just a pilot report
submitted_at: 2018-04-04T16:50:36+00:00
created_at: 2018-04-04T16:50:36+00:00
updated_at: 2018-04-04T17:00:36+00:00
submitted_at: NOW
created_at: NOW
updated_at: NOW
- id: pirepid_2
user_id: 1
airline_id: 1
@@ -469,6 +471,8 @@ pireps:
dpt_airport_id: KJFK
arr_airport_id: KAUS
flight_time: 180 # 6 hours
block_fuel: 20000
fuel_used: 15000
state: 5 # draft
source: 0 # manual
flight_type: J
@@ -494,7 +498,7 @@ pireps:
planned_flight_time: '0'
zfw: null
block_fuel: '21500.25390625'
fuel_used: null
fuel_used: 20000
landing_rate: '0'
score: '0'
route: ''
@@ -503,11 +507,11 @@ pireps:
source_name: vmsacars
state: 0
status: ENR
submitted_at: null
block_off_time: now
block_on_time: null
created_at: now
updated_at: now
submitted_at: NOW
created_at: NOW
updated_at: NOW
- id: pirepid_4
user_id: 1
airline_id: 1
@@ -517,6 +521,8 @@ pireps:
arr_airport_id: KAUS
block_off_time: 2018-04-04T12:42:36+00:00
block_on_time: 2018-04-04T16:42:36+00:00
block_fuel: 100000
fuel_used: 20000
flight_time: 180 # 6 hours
state: 0
status: 0
@@ -524,9 +530,9 @@ pireps:
flight_type: J
route: KAUS SID TNV J87 IAH J2 LCH J22 MEI J239 ATL J52 AJFEB J14 BYJAC Q60 JAXSN J14 COLIN J61 HUBBS J55 SIE STAR KJFK
notes: just a pilot report
submitted_at: 2018-04-04T16:50:36+00:00
created_at: 2018-04-04T16:50:36+00:00
updated_at: 2018-04-04T17:00:36+00:00
submitted_at: NOW
created_at: NOW
updated_at: NOW
pirep_fares:
- id: 1