fix: read temp_unit from briefing_config not a nonexistent temperature_unit setting
This commit is contained in:
@@ -130,7 +130,15 @@ async def recent_items():
|
||||
@_REQUIRE
|
||||
async def get_weather():
|
||||
rows = await weather_svc.get_cached_weather_rows(g.user.id)
|
||||
temp_unit = await get_setting(g.user.id, "temperature_unit", "C")
|
||||
import json as _json
|
||||
raw = await get_setting(g.user.id, "briefing_config", "{}")
|
||||
try:
|
||||
_cfg = _json.loads(raw) if isinstance(raw, str) else (raw or {})
|
||||
temp_unit = _cfg.get("temp_unit", "C")
|
||||
if temp_unit not in ("C", "F"):
|
||||
temp_unit = "C"
|
||||
except Exception:
|
||||
temp_unit = "C"
|
||||
cards = [
|
||||
card for row in rows
|
||||
if (card := weather_svc.parse_weather_card_data(row, temp_unit)) is not None
|
||||
|
||||
Reference in New Issue
Block a user