Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to Csv import Exports #1299

Merged
merged 21 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/Services/ImportExport/AircraftImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
Expand Down
3 changes: 3 additions & 0 deletions app/Services/ImportExport/FlightImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
5 changes: 2 additions & 3 deletions app/Services/ImportExport/SubfleetImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

Expand Down
6 changes: 3 additions & 3 deletions tests/data/aircraft-update.csv
Original file line number Diff line number Diff line change
@@ -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, ,,,
6 changes: 3 additions & 3 deletions tests/data/aircraft.csv
Original file line number Diff line number Diff line change
@@ -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,, ,,
6 changes: 3 additions & 3 deletions tests/data/aircraft_empty_cols.csv
Original file line number Diff line number Diff line change
@@ -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,,,
10 changes: 5 additions & 5 deletions tests/data/flights.csv
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions tests/data/flights_empty_fields.csv
Original file line number Diff line number Diff line change
@@ -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?,
6 changes: 3 additions & 3 deletions tests/data/subfleets.csv
Original file line number Diff line number Diff line change
@@ -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%