diff --git a/tests/test_web_observability.py b/tests/test_web_observability.py index 2f852f0d..c92ae451 100644 --- a/tests/test_web_observability.py +++ b/tests/test_web_observability.py @@ -1861,6 +1861,14 @@ def test_stale_ankara_chart_data_overlays_latest_mgm_canonical(monkeypatch): "report_time": "2026-06-14T09:50:00+00:00", "raw_metar": "METAR LTAC 140950Z 06013KT 9999 16/11 Q1015", }, + "airport_current": { + "temp": 16.0, + "source_code": "mgm", + "source_label": "MGM", + "obs_time": "2026-06-14T09:50:00+00:00", + "report_time": "2026-06-14T09:50:00+00:00", + "raw_metar": "METAR LTAC 140950Z 06013KT 9999 16/11 Q1015", + }, "airport_primary_today_obs": [{"time": "12:50", "temp": 16.0}], "metar_today_obs": [{"time": "12:50", "temp": 16.0}], "metar_recent_obs": [{"time": "12:50", "temp": 16.0}], @@ -1918,7 +1926,10 @@ def test_stale_ankara_chart_data_overlays_latest_mgm_canonical(monkeypatch): assert payload["local_time"] == "17:20" assert payload["airport_primary_today_obs"] == [{"time": "17:20", "temp": 19.0}] assert "raw_metar" not in payload["current"] + assert "raw_metar" not in payload["airport_primary"] assert "report_time" not in payload["airport_primary"] + assert "raw_metar" not in payload["airport_current"] + assert "report_time" not in payload["airport_current"] assert payload["metar_today_obs"] == [] assert payload["metar_recent_obs"] == [] assert payload["metar_status"]["available_for_today"] is False diff --git a/web/services/city_api.py b/web/services/city_api.py index bd65346c..9afb4684 100644 --- a/web/services/city_api.py +++ b/web/services/city_api.py @@ -423,12 +423,11 @@ def _observation_source_code(block: Any) -> str: def _merge_latest_observation_block(base_block: Any, latest_block: Dict[str, Any]) -> Dict[str, Any]: base = dict(base_block) if isinstance(base_block, dict) else {} latest_source = _observation_source_code(latest_block) - base_source = _observation_source_code(base) - if base_source and latest_source and base_source != latest_source: + if latest_source: base = { key: value for key, value in base.items() - if key not in _SOURCE_BOUND_OBSERVATION_FIELDS + if key not in _SOURCE_BOUND_OBSERVATION_FIELDS or key in latest_block } return {**base, **latest_block}