跑道数据改用 tuple 避免 Jinja2 dict unhashable 错误
This commit is contained in:
@@ -88,7 +88,7 @@ def _obs_age(obs_time_str: Optional[str]) -> Optional[int]:
|
||||
pass
|
||||
return None
|
||||
|
||||
def _runway_pairs(city_weather: Dict[str, Any]) -> List[Dict[str, Any]]:
|
||||
def _runway_pairs(city_weather: Dict[str, Any]) -> list:
|
||||
"""Extract runway pairs from AMOS data."""
|
||||
amos = city_weather.get("amos") or {}
|
||||
rw_obs = (amos.get("runway_obs") or {}) if amos else {}
|
||||
@@ -97,7 +97,7 @@ def _runway_pairs(city_weather: Dict[str, Any]) -> List[Dict[str, Any]]:
|
||||
result = []
|
||||
for (r1, r2), (t, _d) in zip(pairs, temps):
|
||||
if t is not None:
|
||||
result.append({"label": f"{r1}/{r2}", "temp": round(float(t), 1)})
|
||||
result.append((f"{r1}/{r2}", round(float(t), 1)))
|
||||
return result
|
||||
|
||||
def _build_city_card(city: str, city_weather: Dict[str, Any], cfg: Dict[str, Any]) -> Dict[str, Any]:
|
||||
|
||||
@@ -117,8 +117,8 @@ body{background:#0f1117;color:#c8cdd4;font-family:-apple-system,BlinkMacSystemFo
|
||||
<div class="runway-divider"></div>
|
||||
{% for rw in c.runway_pairs %}
|
||||
<div class="runway-row">
|
||||
<span class="runway-label">{{ rw["label"] }}</span>
|
||||
<span class="runway-temp">{{ "%.1f"|format(rw["temp"]) }}°C</span>
|
||||
<span class="runway-label">{{ rw[0] }}</span>
|
||||
<span class="runway-temp">{{ "%.1f"|format(rw[1]) }}°C</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user