Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ def _weather_code_to_desc(code: int, language: str = "zh") -> str:
61: "Light rain", 63: "Rain", 65: "Heavy rain",
71: "Light snow", 73: "Snow", 75: "Heavy snow",
80: "Showers", 81: "Showers", 82: "Storm rain",
95: "Thunderstorm", 96: "Hail", 99: "Hail",
95: "Thunderstorm", 96: "Thunderstorm", 99: "Thunderstorm",
}
return mapping.get(code, "Unknown")
mapping = {
Expand All @@ -1070,7 +1070,7 @@ def _weather_code_to_desc(code: int, language: str = "zh") -> str:
61: "小雨", 63: "中雨", 65: "大雨",
71: "小雪", 73: "中雪", 75: "大雪",
80: "阵雨", 81: "阵雨", 82: "暴雨",
95: "雷阵雨", 96: "冰雹", 99: "冰雹",
95: "雷阵雨", 96: "雷阵雨", 99: "雷阵雨",
}
return mapping.get(code, "未知")

Expand Down
9 changes: 9 additions & 0 deletions backend/tests/test_unit_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
get_weather,
search_locations,
_generate_weather_advice,
_weather_code_to_desc,
_qweather_current,
_qweather_forecast_to_standard,
_qweather_icon_to_wmo,
Expand Down Expand Up @@ -224,6 +225,14 @@ async def test_qweather_forecast_to_standard_builds_result(self):
assert result["forecast"][0]["desc"] == "多云"


class TestWeatherCodeDescriptions:
def test_thunderstorm_with_hail_codes_use_general_thunderstorm_label(self):
assert _weather_code_to_desc(96, language="zh") == "雷阵雨"
assert _weather_code_to_desc(99, language="zh") == "雷阵雨"
assert _weather_code_to_desc(96, language="en") == "Thunderstorm"
assert _weather_code_to_desc(99, language="en") == "Thunderstorm"


class TestSearchLocations:
@pytest.mark.asyncio
async def test_search_locations_prefers_administrative_match_from_nominatim(self):
Expand Down
6 changes: 6 additions & 0 deletions webapp/app/config/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@
} finally {
setComposerPreviewLoading(false);
}
}, [composerCatalog, composerState, customModeName, customModeDescription, isEn, mac, previewColors]);

Check warning on line 1039 in webapp/app/config/page.tsx

View workflow job for this annotation

GitHub Actions / Webapp Check (Node 20)

React Hook useCallback has missing dependencies: 'previewHeight' and 'previewWidth'. Either include them or remove the dependency array

useEffect(() => {
if (!composerCatalog) return;
Expand Down Expand Up @@ -3645,6 +3645,12 @@
"Upload up to 6 images. The device cycles to the next image on each refresh.",
)}
</div>
<div className="rounded border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900">
{tr(
"预览或下发只会临时生效;如需下次打开仍保留这些图片,请点击页面上的“保存到设备”。",
"Previewing or sending is temporary. To keep these images next time, click \"Save to Device\" on this page.",
)}
</div>
<div className="grid grid-cols-3 gap-2">
{adaptiveImageUrls.map((url, i) => (
<div key={`${url}-${i}`} className="relative group aspect-[4/3] rounded border border-ink/15 overflow-hidden bg-paper-dark">
Expand Down
Loading