From 90d1708aab6b28602623b986d11fdb421f4090dd Mon Sep 17 00:00:00 2001 From: lesmar54 Date: Wed, 8 Sep 2021 17:50:34 +0400 Subject: [PATCH] Fixes to CSV import Exports (#1299) * Update SubfleetImporter.php Correction to the import to include Simbrief Code * Update SubfleetImporter.php Added in the missing fields HUB-ID and SIMBrief as these are input on the main screen * Update AircraftImporter.php Part of the missing data fields in csv import export * Update FlightImporter.php Part of the missing fields in csv import and export * Update AircraftImporter.php * Update FlightImporter.php * Update aircraft.csv Test data amended as part of the missing csv fields * Update subfleets.csv Part of the fix for missing fields in csv files used for import/export * Update flights.csv * Update FlightImporter.php * Update subfleets.csv Removed unused fields * Update FlightImporter.php * Update FlightImporter.php * Update FlightImporter.php * amended for new csv file layouts --- app/Services/ImportExport/AircraftImporter.php | 2 ++ app/Services/ImportExport/FlightImporter.php | 3 +++ app/Services/ImportExport/SubfleetImporter.php | 5 ++--- tests/data/aircraft-update.csv | 6 +++--- tests/data/aircraft.csv | 6 +++--- tests/data/aircraft_empty_cols.csv | 6 +++--- tests/data/flights.csv | 10 +++++----- tests/data/flights_empty_fields.csv | 4 ++-- tests/data/subfleets.csv | 6 +++--- 9 files changed, 26 insertions(+), 22 deletions(-) diff --git a/app/Services/ImportExport/AircraftImporter.php b/app/Services/ImportExport/AircraftImporter.php index d062483c..01dbd7b3 100644 --- a/app/Services/ImportExport/AircraftImporter.php +++ b/app/Services/ImportExport/AircraftImporter.php @@ -25,9 +25,11 @@ class AircraftImporter extends ImportExport 'subfleet' => 'required', 'iata' => 'nullable', 'icao' => 'nullable', + 'airport_id' => 'nullable', 'name' => 'required', 'registration' => 'required', 'hex_code' => 'nullable', + 'mtow' => 'nullable|numeric', 'zfw' => 'nullable|numeric', 'status' => 'nullable', ]; diff --git a/app/Services/ImportExport/FlightImporter.php b/app/Services/ImportExport/FlightImporter.php index 422a981b..66068119 100644 --- a/app/Services/ImportExport/FlightImporter.php +++ b/app/Services/ImportExport/FlightImporter.php @@ -29,6 +29,7 @@ class FlightImporter extends ImportExport 'airline' => 'required', 'flight_number' => 'required', 'route_code' => 'nullable', + 'callsign' => 'nullable', 'route_leg' => 'nullable', 'dpt_airport' => 'required', 'arr_airport' => 'required', @@ -45,6 +46,8 @@ class FlightImporter extends ImportExport 'pilot_pay' => 'nullable', 'route' => 'nullable', 'notes' => 'nullable', + 'start_date' => 'nullable|date', + 'end_date' => 'nullable|date', 'active' => 'nullable|boolean', 'subfleets' => 'nullable', 'fares' => 'nullable', diff --git a/app/Services/ImportExport/SubfleetImporter.php b/app/Services/ImportExport/SubfleetImporter.php index 10b8fe02..a0625ec3 100644 --- a/app/Services/ImportExport/SubfleetImporter.php +++ b/app/Services/ImportExport/SubfleetImporter.php @@ -20,15 +20,14 @@ class SubfleetImporter extends ImportExport */ public static $columns = [ 'airline' => 'required', + 'hub_id' => 'required', 'type' => 'required', + 'simbrief_type' => 'nullable', 'name' => 'required', 'fuel_type' => 'nullable', 'cost_block_hour' => 'nullable', 'cost_delay_minute' => 'nullable', 'ground_handling_multiplier' => 'nullable', - 'cargo_capacity' => 'nullable', - 'fuel_capacity' => 'nullable', - 'gross_weight' => 'nullable', 'fares' => 'nullable', ]; diff --git a/tests/data/aircraft-update.csv b/tests/data/aircraft-update.csv index 77258a52..08bc344f 100644 --- a/tests/data/aircraft-update.csv +++ b/tests/data/aircraft-update.csv @@ -1,3 +1,3 @@ -subfleet,iata, icao, name,registration,hex_code,zfw,status -A32X,A320,320,A320-211,N309US,,,S -74X,747 400, ,, +subfleet,iata, icao,airport_id, name,registration,hex_code,mtow,zfw,status +A32X,A320,320,,A320-211,N309US,,,,S +74X,747 400, ,,, diff --git a/tests/data/aircraft.csv b/tests/data/aircraft.csv index 69c68b75..d3ade334 100644 --- a/tests/data/aircraft.csv +++ b/tests/data/aircraft.csv @@ -1,3 +1,3 @@ -subfleet,iata, icao, name,registration,hex_code,zfw,status -A32X,A320,320,A320-211,N309US,,,A -74X,747 400, ,, +subfleet,iata, icao,airport_id, name,registration,hex_code,mtow,zfw,status +A32X,A320,320,,A320-211,N309US,,,,A +74X,747 400,, ,, diff --git a/tests/data/aircraft_empty_cols.csv b/tests/data/aircraft_empty_cols.csv index 645052ce..3426f63a 100644 --- a/tests/data/aircraft_empty_cols.csv +++ b/tests/data/aircraft_empty_cols.csv @@ -1,3 +1,3 @@ -subfleet,name,registration,hex_code,status -A32X,A320-211,N309US,, - , B744-GE, N304,, +subfleet,iata, icao,airport_id, name,registration,hex_code,mtow,zfw,status +A32X,A320-211,,N309US,,, + , B744-GE,, N304,,, diff --git a/tests/data/flights.csv b/tests/data/flights.csv index db2f99a7..836cc2af 100644 --- a/tests/data/flights.csv +++ b/tests/data/flights.csv @@ -1,5 +1,5 @@ -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,pilot_pay,route,notes,active,subfleets,fares,fields -VMS,1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,85,0,100, 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 -VMS,999,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,85,0,100, ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X;B737,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41 +airline,flight_number,route_code,callsign,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,load_factor, load_factor_variance,pilot_pay,route,notes,start_date,end-date,active,subfleets,fares,fields +VMS,1972,,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,85,0,100, 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 +VMS,999,,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,85,0,100, ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",,,1,A32X;B737,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41 diff --git a/tests/data/flights_empty_fields.csv b/tests/data/flights_empty_fields.csv index 3e2b4a18..e076f234 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,load_factor, load_factor_variance,pilot_pay,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,callsign,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,load_factor, load_factor_variance,pilot_pay,route,notes,start_date,end-date,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?, diff --git a/tests/data/subfleets.csv b/tests/data/subfleets.csv index 1002c269..50853bc2 100644 --- a/tests/data/subfleets.csv +++ b/tests/data/subfleets.csv @@ -1,3 +1,3 @@ -airline,type,name,fuel_type,cost_block_hour,cost_delay_minute,ground_handling_multiplier,cargo_capacity,fuel_capacity,gross_weight,fares -VMS,A32X,"Airbus A320",,1000,0,200,,,,Y;B?capacity=100&price=500% -VMS, ,"Boeing 747-400",,1000,0,200,,,,Y;B?capacity=100&price=500% +airline,hub_id,type,simbrief_type,name,fuel_type,cost_block_hour,cost_delay_minute,ground_handling_multiplier,fares +VMS,KAUS,A32X,,"Airbus A320",,1000,0,200,Y;B?capacity=100&price=500% +VMS,EGPH, ,,"Boeing 747-400",,1000,0,200,Y;B?capacity=100&price=500%