fix: /api/briefing/weather returns card-format data for WeatherCard component
This commit is contained in:
@@ -129,8 +129,13 @@ async def recent_items():
|
|||||||
@briefing_bp.route("/weather", methods=["GET"])
|
@briefing_bp.route("/weather", methods=["GET"])
|
||||||
@_REQUIRE
|
@_REQUIRE
|
||||||
async def get_weather():
|
async def get_weather():
|
||||||
data = await weather_svc.get_cached_weather(g.user.id)
|
rows = await weather_svc.get_cached_weather_rows(g.user.id)
|
||||||
return jsonify({"locations": data})
|
temp_unit = await get_setting(g.user.id, "temperature_unit", "C")
|
||||||
|
cards = [
|
||||||
|
card for row in rows
|
||||||
|
if (card := weather_svc.parse_weather_card_data(row, temp_unit)) is not None
|
||||||
|
]
|
||||||
|
return jsonify({"locations": cards})
|
||||||
|
|
||||||
|
|
||||||
@briefing_bp.route("/weather/geocode", methods=["POST"])
|
@briefing_bp.route("/weather/geocode", methods=["POST"])
|
||||||
|
|||||||
Reference in New Issue
Block a user