nightscout / nightguard

iOS and WatchOS Client for the Nightscout CGM System
GNU Affero General Public License v3.0
240 stars 158 forks source link

Time calculation for highs and lows is wrong #250

Open motinis opened 1 year ago

motinis commented 1 year ago

I’ve seen some wonky time calculations. Yesterday for example at 21:08 we had it showing 20% high when using the Today view (which is correct) but that was 9 hours and 5 minutes. Clearly that is wrong since 9 hours would be over 42% for that time period. Even if it was calculated for the entire 24 hours, 9 hours would be 37.5%. So something is definitely off.

thank you for the amazing app!

dhermanns commented 1 year ago

Hi @florianpreknya! Could you have an eye on this?

motinis commented 1 year ago

So 1 thing I just noticed is that we have Loop directly updating Nightscout and NS is also pulling from dexcom via bridge. We did this since in certain situations we have oddly seen that sometimes one is able to upload data and the other isn’t (not in a consistent way). We’re not sure why that is - it’s probably related to spotty cell coverage.

But here too there is something weird. “Yesterday” shows 576 readings as expected (2x 288) and ”Today” shows 559 currently. Last 24 hours though shows 624 which I don’t understand.

In any case, I think that the problem in the high and low calculations may derive from having duplicate entries and thus things are counted twice.