fix: enrich route destination names from airport DB when not stored
Specific-airports mode scans never resolved full airport names — they stored the IATA code as destination_name. Fixed in two places: - airports.py: add lookup_airport(iata) cached helper - api_server.py: enrich destination_name/city on the fly in the routes endpoint when the stored value equals the IATA code (fixes all past scans) - scan_processor.py: resolve airport names at scan time in specific-airports mode using lookup_airport (fixes future scans at the DB level) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ from datetime import datetime, date, timedelta
|
||||
import json
|
||||
|
||||
from database import get_connection
|
||||
from airports import get_airports_for_country
|
||||
from airports import get_airports_for_country, lookup_airport
|
||||
from searcher_v3 import search_multiple_routes
|
||||
|
||||
|
||||
@@ -180,7 +180,10 @@ async def process_scan(scan_id: int):
|
||||
else:
|
||||
# Specific airports mode: parse comma-separated list
|
||||
destination_codes = [code.strip() for code in country_or_airports.split(',')]
|
||||
destinations = [] # No pre-fetched airport details; fallback to IATA code as name
|
||||
destinations = [
|
||||
lookup_airport(code) or {'iata': code, 'name': code, 'city': ''}
|
||||
for code in destination_codes
|
||||
]
|
||||
logger.info(f"[Scan {scan_id}] Mode: Specific airports ({len(destination_codes)} destinations: {destination_codes})")
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user