修复首尔/釜山跑道温度偶发不展示:过滤 None 值并增加回退
AMOS 部分跑道对温度可能为 None(传感器暂时不可用), 之前直接 format None 导致静默跳过整组跑道显示。 改为只展示有效跑道对,全部不可用时回退到当前实测。 Tested: pytest 176 passed, AMOS 实测 runway_pairs=4 temperatures 2/4 valid
This commit is contained in:
@@ -776,10 +776,13 @@ def _build_airport_status_message(
|
||||
station_temp = current.get("temp")
|
||||
|
||||
lines = [header, ""]
|
||||
runway_shown = False
|
||||
if runway_pairs and runway_temps and len(runway_pairs) == len(runway_temps):
|
||||
for (r1, r2), (t, _d) in zip(runway_pairs, runway_temps):
|
||||
lines.append(f"{r1}/{r2} {t:.1f}°C")
|
||||
elif station_temp is not None:
|
||||
if t is not None:
|
||||
lines.append(f"{r1}/{r2} {t:.1f}°C")
|
||||
runway_shown = True
|
||||
if not runway_shown and station_temp is not None:
|
||||
label = "AROME预报" if city == "paris" else "当前实测"
|
||||
lines.append(f"{label}:{station_temp:.1f}°C")
|
||||
if deb_pred is not None:
|
||||
|
||||
Reference in New Issue
Block a user