From 95b55d4ab357601cba8b76c5dd711b84f627793c Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Mon, 15 Jun 2026 20:49:37 +0800 Subject: [PATCH] Replace stale runway history on raw backfill --- tests/test_latest_observation_overlay.py | 10 ++++++++-- web/services/latest_observation_overlay.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_latest_observation_overlay.py b/tests/test_latest_observation_overlay.py index 103812c4..76b68543 100644 --- a/tests/test_latest_observation_overlay.py +++ b/tests/test_latest_observation_overlay.py @@ -152,10 +152,16 @@ def test_overlay_builds_amsc_runway_history_from_raw_store(): result = overlay_latest_amsc_observation( FakeDB(), "chengdu", - {"name": "chengdu", "temp_symbol": "°C", "runway_plate_history": {}}, + { + "name": "chengdu", + "temp_symbol": "°C", + "runway_plate_history": { + "02L/20R": [{"time": "2026-06-12T10:44:00+00:00", "temp": 31.6}], + }, + }, ) - assert result["runway_plate_history"]["02L/20R"][-2:] == [ + assert result["runway_plate_history"]["02L/20R"] == [ {"time": "2026-06-15T11:04:00+00:00", "temp": 25.6}, {"time": "2026-06-15T11:08:00+00:00", "temp": 25.4}, ] diff --git a/web/services/latest_observation_overlay.py b/web/services/latest_observation_overlay.py index 3562e23a..f7137fdd 100644 --- a/web/services/latest_observation_overlay.py +++ b/web/services/latest_observation_overlay.py @@ -368,7 +368,7 @@ def _append_amsc_runway_history_from_raw_store( except Exception as exc: logger.debug("latest AMSC raw history overlay skipped city={}: {}", city, exc) return False - payload["runway_plate_history"] = deepcopy(existing_history) if isinstance(existing_history, dict) else {} + payload["runway_plate_history"] = {} changed = False for row in rows if isinstance(rows, list) else []: if not isinstance(row, dict):