Prefer static DB type descriptions over the ICAO descriptor table lookup.

This commit is contained in:
Oliver Jowett 2016-09-14 18:25:21 +01:00
parent b59d0b6bcb
commit d1790cd411

View file

@ -84,18 +84,20 @@ function getIcaoAircraftTypeData(aircraftData, defer) {
} }
function lookupIcaoAircraftType(aircraftData, defer) { function lookupIcaoAircraftType(aircraftData, defer) {
if (_aircraft_type_cache !== null && "t" in aircraftData) { if (_aircraft_type_cache !== null && "t" in aircraftData) {
var typeDesignator = aircraftData.t.toUpperCase(); var typeDesignator = aircraftData.t.toUpperCase();
if (typeDesignator in _aircraft_type_cache) { if (typeDesignator in _aircraft_type_cache) {
var typeData = _aircraft_type_cache[typeDesignator]; var typeData = _aircraft_type_cache[typeDesignator];
if (typeData.desc != undefined && typeData.desc != null && typeData.desc.length == 3) { if (typeData.desc != undefined && aircraftData.desc === undefined && typeData.desc != null && typeData.desc.length == 3) {
aircraftData.desc = typeData.desc; aircraftData.desc = typeData.desc;
} }
aircraftData.wtc = typeData.wtc; if (typeData.wtc != undefined && aircraftData.wtc === undefined) {
aircraftData.wtc = typeData.wtc;
}
}
} }
}
defer.resolve(aircraftData); defer.resolve(aircraftData);
} }
var _request_count = 0; var _request_count = 0;