Get(true).proportion returns NaN
The metadata script:
return WTenabled.past(HOUR, 1).get(true).proportion * 100; // % on last hour
works in Mango 1.12.3, returning values between 0 and 100 inclusive depending on the past hour.
However, it no longer works in MA 2.0: it returns: "Success. result=NaN"
If I change get(true) to get(false):
return WTenabled.past(HOUR, 1).get(false).proportion * 100; // % on last hour
it returns: "Success. result=0.0"
I wonder if the proportion code is missing a check for 0/0?
Are there actually any values over the past hour? You may need to add a check for "count > 0". (Not the actual code required, just saying...)
There are no transitions during the past hour, but it did have a value that should have returned either 0% or 100%. as it did under M2M 1.12.3 even when there were no changes in the last hour. Also, get(false).proportion returns 0.0 but get(true).proportion returns NaN. If false returns 0.0, shouldn't true return 1.0?
I see that now there is a .percentage function that can be used insead of .proportion * 100%. I tried it with the same result.
Thank you for helping.
I found the problem. There will be a fix for this in the next release.
Great, thanks! Would that be 2.0.4? Where can I find the release notes or planned release date?