JohanDegraeve / xdripswift

xdrip for iOS, written in Swift
GNU General Public License v3.0
339 stars 337 forks source link

Carb entries uploaded to NS from FAX are not removed from xdripswift treatments when deleted from FAX [FreeAPS X] #385

Closed bjornoleh closed 2 years ago

bjornoleh commented 2 years ago

Carb entries uploaded to NS from FreeAPS X are not removed from xdripswift treatments when deleted from FAX. E.g after a double entry, the erroneous one will stay in xdripswift after deleting from FAX. Nightscout does update correctly when entries are deleted from FAX.

Waiting for several hours did not change anything.

8F64792B-1E45-410E-9987-1FC0AF3A7B81

@paulplant

LiroyvH commented 2 years ago

Ohh, FreeAPSX. Was already wondering what the fax you were talking about. ;)

Anyway, this seems to be a generic thing not necessarily linked to FAX. Any entry that it has once picked up will not be expunged on update until you manually remove it. For example:

This may be by design for some reason, just adding this additional info that it's not limited to the entries/modifications from one application. :)

JohanDegraeve commented 2 years ago

xdrip4ios verifies only updates, not deletions. To do updates, it fetches all treatments of the latest 24 hours (doing this every time it connects to NS, which can go up to every 15 seconds), and compares the values.

i think it's feasible to handle also deletions. Any treatment that was already uploaded successfully in the past , and is not found anymore in the list of treatments of the last 24 hours, could be marked as deleted

paulplant commented 2 years ago

This may be by design for some reason, just adding this additional info that it's not limited to the entries/modifications from one application. :)

Yep - the behaviour was done by design, but that doesn't mean it's the best way to do it :)

The original implementation just assumes that all treatment manipulation is to be done by xDrip4iOS. But yes, I fully agree - we should assume that every app under the sun (including the NS web interface) can also be used to edit and delete treatments.

I agree with Johan - we should look at checking and marking as deleted "dead" treatments.

Another one for the list :)

bjornoleh commented 2 years ago

Thanks! Yes, other apps/NS web can and will be used to delete entries, so better have these deleted also in Xdrip

bjornoleh commented 2 years ago

https://github.com/JohanDegraeve/xdripswift/commit/64bd7f6014ac8fc29340832c9e4117e59a0caeda fixes the issue with recently added entries that have been deleted in FAX or NS. Thanks!

I have not tested with older entries, but this is of lesser relevance and importance.