Refine ATC decision routing and ATIS handling

This commit is contained in:
Remi
2025-09-18 19:39:19 +02:00
committed by itsrubberduck
parent 5d968e0e63
commit de737c5fb7
3 changed files with 292 additions and 23 deletions

View File

@@ -37,6 +37,8 @@ const TYPE_LABELS: Record<string, string> = {
const TYPE_ORDER = ['ATIS', 'DEL', 'CLD', 'GND', 'TWR', 'DEP', 'APP', 'CTR', 'ACC', 'FSS']
const ATIS_FREQUENCY_PLACEHOLDER = '---'
function toTypeLabel(rawType: string | undefined, fallback?: string): { type: string; label: string } {
const type = (rawType || 'UNK').toUpperCase()
const label = TYPE_LABELS[type] || fallback || type
@@ -133,8 +135,8 @@ export default defineEventHandler(async (event): Promise<FrequencyResponse> => {
for (const atis of atisEntries) {
const callsign = String(atis?.callsign || '')
if (!callsign.toUpperCase().startsWith(prefix)) continue
const frequency = normalizeFrequency(atis?.frequency)
if (!frequency) continue
const normalizedFrequency = normalizeFrequency(atis?.frequency)
const frequency = normalizedFrequency || ATIS_FREQUENCY_PLACEHOLDER
const { type, label } = toTypeLabel('ATIS', atis?.name)
addFrequencyEntry(frequencyMap, {
type,