Replace stale runway history on raw backfill
This commit is contained in:
@@ -152,10 +152,16 @@ def test_overlay_builds_amsc_runway_history_from_raw_store():
|
|||||||
result = overlay_latest_amsc_observation(
|
result = overlay_latest_amsc_observation(
|
||||||
FakeDB(),
|
FakeDB(),
|
||||||
"chengdu",
|
"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:04:00+00:00", "temp": 25.6},
|
||||||
{"time": "2026-06-15T11:08:00+00:00", "temp": 25.4},
|
{"time": "2026-06-15T11:08:00+00:00", "temp": 25.4},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ def _append_amsc_runway_history_from_raw_store(
|
|||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.debug("latest AMSC raw history overlay skipped city={}: {}", city, exc)
|
logger.debug("latest AMSC raw history overlay skipped city={}: {}", city, exc)
|
||||||
return False
|
return False
|
||||||
payload["runway_plate_history"] = deepcopy(existing_history) if isinstance(existing_history, dict) else {}
|
payload["runway_plate_history"] = {}
|
||||||
changed = False
|
changed = False
|
||||||
for row in rows if isinstance(rows, list) else []:
|
for row in rows if isinstance(rows, list) else []:
|
||||||
if not isinstance(row, dict):
|
if not isinstance(row, dict):
|
||||||
|
|||||||
Reference in New Issue
Block a user