+1

Todaycount() value in CounterLogs, bug

Paul G 3 years ago in bOS Configurator updated by Kristián Vojčík 3 years ago 1

Hi,


When using a CounterLog tasks, the input value used to populate its values only trigger the function to update the TotalValue() value, he remaining values (e.g. Average, Last 24 hours, Daily) are only updated every hour on or about on the hour.

The above possess a significant bug that needs to be fixed, otherwise those using any of those values updated only on the hour or immediately after receive incorrect calculations. This is because bOS calculates those remaining values after the o'clock, hence allocating such value to the next day hence creating and giving significant incorrect information, if this is not a bug then you should forbid using those values in calculations as the result will always be wrong


bOS version 4.7, the below screenshot shows this perfectly, the three graphs use the same calculation against the value. I thought I was doing somethign incorrect, to the point I had to create specific test cases to find out what the hell was going on, effectively proving somethign is wrong in bOS

Graph1 uses 3 variables (one always 0) in the polynom, using TotalValue(), which is updated on the spot by bOS

Graph2 uses 3 variables (one always 0) in the polynom, using TodayCount(), which is NOT updated on the spot by bOS, but on the hour, after the o'clock

Graph3 uses 2 variables in the polynom, using TotalValue(), using TotalValue(), which is updated on the spot by bOS

The results can be easily seen below, at 20:00 the counter shows the correct usage of 1 L of water between 20:00 and 20:59, two graphs are correct, the third one is wrong because the TodayCount calculation happens after 20:59:59 hence pushing the 1L usage of water to the 21:00 to 21:59 block. weird ehh?  The worst part comes at midnight, because at that point the TodayCount does the best weird calculation, the whole day calculation moves to the next day, hence creating an artificial and incorrect 24 L use on the following day, completely wrong way of calculating the values.  The 24L was the actual waster of water in the previous day, but because the function does the calculation past midnight then we get a terrible wrong result, showing that actually past midnight there had been a waste of 25 L of water.

Image 2869

Image 2868