Skip to content

Commit 88ca9fd

Browse files
clauderzueger
authored andcommitted
Skip anonymized arrivals in landings report
Anonymized records have null immatriculation, which can't be meaningfully grouped in a per-aircraft landing summary. Skip them and add defensive null-safe sorting. https://claude.ai/code/session_01KHZDkEfyznUCcoGCWrGdsY
1 parent 94b8899 commit 88ca9fd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/util/LandingsReport.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class LandingsReport {
6868
const arrival = firebaseToLocal(record.val());
6969
const { immatriculation, mtow, landingCount } = arrival;
7070

71+
if (!immatriculation) return;
72+
7173
if (!map[immatriculation]) {
7274
map[immatriculation] = {
7375
immatriculation,
@@ -90,7 +92,7 @@ class LandingsReport {
9092
Object.keys(map).forEach(key => {
9193
arr.push(map[key]);
9294
});
93-
arr.sort((a1, a2) => a1.immatriculation.localeCompare(a2.immatriculation));
95+
arr.sort((a1, a2) => (a1.immatriculation || '').localeCompare(a2.immatriculation || ''));
9496

9597
return arr;
9698
}

0 commit comments

Comments
 (0)