From 49cf7f8f60cd910d459e94116c48735bb7530d02 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 9 Jan 2026 14:32:14 -0500 Subject: [PATCH] feat: enhance periodic sync logging and improve airport mode handling in LocationSearchMap --- backend/server/run_periodic_sync.py | 4 +- .../shared/LocationSearchMap.svelte | 50 +++++++++++-------- frontend/src/locales/en.json | 6 ++- .../src/routes/worldtravel/[id]/+page.svelte | 12 +++-- 4 files changed, 44 insertions(+), 28 deletions(-) diff --git a/backend/server/run_periodic_sync.py b/backend/server/run_periodic_sync.py index adb01210..abe40dd8 100644 --- a/backend/server/run_periodic_sync.py +++ b/backend/server/run_periodic_sync.py @@ -63,7 +63,7 @@ def run_sync(): def main(): """Main loop - run sync every INTERVAL_SECONDS.""" - logger.info(f"Starting periodic sync (interval: {INTERVAL_SECONDS}s)") + logger.info(f"Starting periodic sync worker for midnight background jobs...") # Install signal handlers so supervisord (or other process managers) # can request a clean shutdown using SIGTERM/SIGINT. @@ -76,7 +76,7 @@ def main(): wait_seconds = _seconds_until_next_midnight() hours = wait_seconds / 3600.0 logger.info( - f"Next sync scheduled in {wait_seconds:.0f}s (~{hours:.2f}h) at local midnight" + f"Next sync scheduled in {wait_seconds:.0f}s (~{hours:.2f}h) at UTC midnight" ) # Sleep until midnight or until stop event is set if _stop_event.wait(wait_seconds): diff --git a/frontend/src/lib/components/shared/LocationSearchMap.svelte b/frontend/src/lib/components/shared/LocationSearchMap.svelte index 55086216..5d8a831e 100644 --- a/frontend/src/lib/components/shared/LocationSearchMap.svelte +++ b/frontend/src/lib/components/shared/LocationSearchMap.svelte @@ -78,31 +78,39 @@ // track previous airport mode to detect toggles let prevAirportMode = airportMode; + let airportModeInitialized = false; - // Clear inputs/selections when airportMode is toggled + // Clear inputs/selections when airportMode is toggled (but not during initial setup) $: if (prevAirportMode !== airportMode) { prevAirportMode = airportMode; - // clear single-location search state - searchQuery = ''; - searchResults = []; - selectedLocation = null; - selectedMarker = null; - locationData = null; - // clear transportation-mode search state - startSearchQuery = ''; - endSearchQuery = ''; - startSearchResults = []; - endSearchResults = []; - selectedStartLocation = null; - selectedEndLocation = null; - startMarker = null; - endMarker = null; - mapBounds = null; - startLocationData = null; - startCode = null; - endCode = null; - endLocationData = null; + // Only clear if this is not the first time airportMode is being set + // This prevents wiping out initial location data when editing existing plane transportations + if (airportModeInitialized) { + // clear single-location search state + searchQuery = ''; + searchResults = []; + selectedLocation = null; + selectedMarker = null; + locationData = null; + + // clear transportation-mode search state + startSearchQuery = ''; + endSearchQuery = ''; + startSearchResults = []; + endSearchResults = []; + selectedStartLocation = null; + selectedEndLocation = null; + startMarker = null; + endMarker = null; + mapBounds = null; + startLocationData = null; + startCode = null; + endCode = null; + endLocationData = null; + } + + airportModeInitialized = true; } // Transportation mode variables diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index c1a465ea..02cabe1b 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -922,7 +922,11 @@ "enter_from_location": "Enter from location", "enter_to_location": "Enter to location", "arrival_code": "Arrival Code", - "departure_code": "Departure Code" + "departure_code": "Departure Code", + "arrival_date": "Arrival Date", + "departure_timezone": "Departure Timezone", + "arrival_timezone": "Arrival Timezone", + "departure_date": "Departure Date" }, "lodging": { "new_lodging": "New Lodging", diff --git a/frontend/src/routes/worldtravel/[id]/+page.svelte b/frontend/src/routes/worldtravel/[id]/+page.svelte index 2cf3f158..e57daa21 100644 --- a/frontend/src/routes/worldtravel/[id]/+page.svelte +++ b/frontend/src/routes/worldtravel/[id]/+page.svelte @@ -181,10 +181,14 @@ const regionClusterOptions: ClusterOptions = { radius: 300, maxZoom: 8, minPoints: 1 }; let regionsGeoJson: RegionFeatureCollection = { type: 'FeatureCollection', features: [] }; - $: regionsGeoJson = { - type: 'FeatureCollection', - features: regions.map((r) => regionToFeature(r)).filter((f): f is RegionFeature => f !== null) - }; + $: { + // Explicitly depend on visitedRegions to trigger reactivity when visit status changes + visitedRegions; + regionsGeoJson = { + type: 'FeatureCollection', + features: regions.map((r) => regionToFeature(r)).filter((f): f is RegionFeature => f !== null) + }; + } function getMarkerProps(feature: any): RegionFeatureProperties | null { return feature && feature.properties ? feature.properties : null;