Replace stale runway history on raw backfill

This commit is contained in:
2569718930@qq.com
2026-06-15 20:49:37 +08:00
parent 07e28481e8
commit 95b55d4ab3
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -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},
]
+1 -1
View File
@@ -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):