Skip to content

馃崚 weather/noaa: Adapt to server API changes / Improve the days shown in the forecast

Ismael Asensio requested to merge work/cherry-pick-weather-noaa into Plasma/6.1

Cherry-pick MR including two commits

weather/noaa: Improve the days shown in the forecast

Previously, a day would be filtered out from showing in the applet when it didn't have for instance the minimum temperature (which usually happens for the last day)

Let's filter out day forecasts only if they don't provide the weather condition, instead of min/max temperatures.

Also report the actual number of days after the filtering, instead of the total days in the report. Otherwise we could show less days than we claim on the tab.

(cherry picked from commit 79a96ffb)

weather/noaa: Adapt to server API changes

Recently, the weather applet has been failing to show forecast reports for the NOAA provider. This is a mix of the server rejecting some of the forecast requests and a small API change we weren't parsing correctly.

After some digging, this improves the chance of showing them right, or at least get a log when they don't.

  • Set a precision limit on the lat/lon parameters in the request to reduce the chance of the server rejecting it

  • When parsing the xml response, check for a layout-key that indicates daily forecast (24h), but not specifically 7-days, since now sometimes we also get an 8-days report

  • In case of a server error issue, parse the returned message and log it. It can help future debugging but it's not really useful or actionable to the user.

(cherry picked from commit 35f624be)

Merge request reports