From d17f02703542b68dd9db57b48c9ccdc38f63de7a Mon Sep 17 00:00:00 2001 From: Carlos Salaverria Date: Mon, 29 Aug 2016 10:07:03 -0500 Subject: [PATCH] Add aircraft type information to planeObject --- public_html/dbloader.js | 4 +--- public_html/planeObject.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/public_html/dbloader.js b/public_html/dbloader.js index 2666cf0..2d2a545 100644 --- a/public_html/dbloader.js +++ b/public_html/dbloader.js @@ -89,9 +89,7 @@ function lookupIcaoAircraftType(aircraftData, defer) { if (typeDesignator in _aircraft_type_cache) { var typeData = _aircraft_type_cache[typeDesignator]; if (typeData.desc != undefined && typeData.desc != null && typeData.desc.length == 3) { - aircraftData.aircraftTypeCode = typeData.desc.charAt(0); - aircraftData.engineCount = parseInt(typeData.desc.charAt(1)); - aircraftData.engineTypeCode = typeData.desc.charAt(2); + aircraftData.desc = typeData.desc; } aircraftData.wtc = typeData.wtc; } diff --git a/public_html/planeObject.js b/public_html/planeObject.js index 1deb0bc..17aca6d 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -46,6 +46,10 @@ function PlaneObject(icao) { // request metadata this.registration = null; this.icaotype = null; + this.aircraftTypeCode = null; + this.engineCount = null; + this.engineType = null; + this.wtc = null; getAircraftData(this.icao).done(function(data) { if ("r" in data) { this.registration = data.r; @@ -55,6 +59,16 @@ function PlaneObject(icao) { this.icaotype = data.t; } + if ("desc" in data) { + this.aircraftTypeCode = data.desc.charAt(0); + this.engineCount = parseInt(data.desc.charAt(1)); + this.engineTypeCode = data.desc.charAt(2); + } + + if ("wtc" in data) { + this.wtc = data.wtc; + } + if (this.selected) { refreshSelected(); }