fix(flights): class an aircraft by its feed's type from the first fix

A civil aircraft was drawn as an airliner until its type lookup answered,
even when its feed already named the type: a helicopter showed the
airliner icon and model for as long as the lookup took.

- Flights classes every contact, and picks its model, by the feed's own
  ICAO type designator from the first fix. A looked-up type replaces it
  once the lookup answers and outranks the feed's on every later poll;
  the lookup still runs and fills the type name and registration.
- A surface emitter category still keeps only a ground type (ZVEH, GRND)
  from the feed.
- State vectors have no type field, so an /api/flights answer may send
  `typeByIcao` beside them, by ICAO address, as `emergencyByIcao` is sent.
  The regional adsb.lol fallback now sends it from each row's `t`.
This commit is contained in:
Sameh Khamis committed 2026-11-17 17:37:48 -08:00
1 parent 2f0c01eaa7
commit f2537743ab
9 files changed
+205 -24

No files matched your search

+15
View File
@@ -614,3 +614,18 @@ test('a vessel with no name is not named by its id; a ten-digit MMSI is an MMSI'
);
assert.equal(named.name, 'EVER GIVEN');
});
test('a type sent alongside the state vectors becomes the record type code', () => {
const row = (id) => [id, 'TEST1', 'US', 1, 1, -77, 39, 1000, false, 100, 90];
const snapshot = openSkySnapshot({
time: 1,
states: [row('abc123'), row('def456')],
typeByIcao: { abc123: ' ec45 ', zzz999: 'B738' },
});
assert.equal(snapshot.records[0].typeCode, 'EC45');
assert.equal(snapshot.records[1].typeCode, null);
assert.equal(
openSkySnapshot({ states: [row('abc123')] }).records[0].typeCode,
null,
);
});