Closed Navid200 closed 3 months ago
I have tested this with fake data source. Please see the results in the following two images. Please look at the time, the sensor expiry note at the bottom and the sensor expiry alert flag content.
You can see that the sensor expiry alert flag now shows 1 decimal point.
There is still something wrong:
There seems to be a 0.4-hour discrepancy. That is 60 x 0.4 = 24 minutes.
I will investigate.
This one looks much better:
I may just be looking at the rounding effect to 1 decimal point. Let's see what the 2-hour notification looks like.
This looks pretty good to me.
Fixes: https://github.com/NightscoutFoundation/xDrip/issues/3569 Sensor expiry alert shows "Sensor will expire in 1 hour" even if 1.99 hours are still l eft to expiry as shown here: https://github.com/NightscoutFoundation/xDrip/issues/3569.
I can speculate that the intent was for the alert to show 24 hours left and 12 hours left, and 6 hours left and 2 hours left. But, because we want this to be a silent alert, we have made it wait for the screen to be unlocked or the charger to be disconnected.
As a result, when 2 hours are left to expiry, the alert does not trigger. it triggers when the user unlocks the phone after that time. But, the format chosen can only show integer values.
The 24-hour value shows 23 hours are left. The 12 hour alert shows 11 hours are left. It is really bad when the 2-hour alert shows 1 hour left.
This PR rounds down the value to 1 decimal point instead of dropping the fractional part completely.
Not tested yet
I have tested a fictitious case and verified functionality. However, I will test this in real action in 10 days with a G7.
Please let me know if I have overlooked anything.