MagicMirrorOrg/MagicMirror

Precipitation Probability not displayed when it is 0%

vppencilsharpener opened this issue · 0 comments

OS: Ubuntu 22.04.3 LTS
Node: v21.5.0
MagicMirror Version: 2.26.0

In the hourly weather display, when the the Precipitation Probability is 0 the table cell is blank/empty. For consistency I would expect it to display “0%”

Steps to Reproduce:
I am using the WeatherGov module, but I believe this would be reproducible on any module that uses the weather.js library. To reproduce display the precipitation probability in the hourly weather module and have a dry time period where the precipitation probably is returned as 0%.

Expected Results:
To be consistent in the hourly chart, I would expect the table cell to be populated with 0% instead of blank. That gives confidence that data is being returned instead of it being an unknown (i.e. is it zero or is it missing data).

Additional Notes:
I think the problem is with modules\default\weather\weather.js line 238.
If the type is “precip” and the value is 0 or the formated value is “0.00”, then a blank value is returned.
I don’t believe the zero check to be valid for the Precipitation Probability data and instead would send zero values to the WeatherUtils.convertPrecipitationUnit function. There does not appear to be anything in that function that cannot handle a zero value so it should not cause other problems.
Null values should continue to return a blank/empty value as they do now.

I've made the change locally and will submit a pull request shortly.