Fix error in flight importer
This commit is contained in:
parent
184123194b
commit
0bf1286c3a
@ -62,7 +62,6 @@ class Flight extends Model
|
||||
'level' => 'integer',
|
||||
'distance' => 'float',
|
||||
'flight_time' => 'integer',
|
||||
'flight_type' => 'integer',
|
||||
'has_bid' => 'boolean',
|
||||
'active' => 'boolean',
|
||||
];
|
||||
|
@ -92,8 +92,14 @@ class FlightImporter extends ImportExport
|
||||
}
|
||||
|
||||
// Any specific transformations
|
||||
// Flight type can be set to P - Passenger, C - Cargo, or H - Charter
|
||||
$flight->setAttribute('flight_type', FlightType::getFromCode($row['flight_type']));
|
||||
|
||||
// Check for a valid value
|
||||
$flight_type = $row['flight_type'];
|
||||
if(!array_key_exists($flight_type, FlightType::labels())) {
|
||||
$flight_type = 'J';
|
||||
}
|
||||
|
||||
$flight->setAttribute('flight_type', $flight_type);
|
||||
$flight->setAttribute('active', get_truth_state($row['active']));
|
||||
|
||||
try {
|
||||
|
@ -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,P,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,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
|
||||
|
|
Loading…
Reference in New Issue
Block a user