-
Notifications
You must be signed in to change notification settings - Fork 71.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NS API will not delete treatments (regression in v0.11.1) #4461
Comments
This is due to modifying the treatments DELETE API to comply with the query formats used by the other collections and other query API formats. Part of the standard format is that if a date is not provided in the query, a date is added by |
@jpcunningh @Pogman Can either of you summarize what we need to do. Am I right this is a regression, or is it something that @Pogman expected to work, but never worked for treatments. I don't think I fully grasp the issue, and never delete treatments (except for indiviual ones with the Nightscout UI and that works for me) |
The .../api/v1/treatments/id has always worked as expected pre v0.11.1 and was in fact the only way to delete a treatment as no other method existed. This method still works but is now limited to 4 days max and I would recommend changing it so as to not be limited so that deleting directly by id always works. Having a default limit for the new query based stuff seems fine. One side effect of the v0.11.1 implementation is that the api will always return as a successful complete operation even if it fails due to the date limit. Going forward for the 600 Uploader I will add a check against NS versions and use the appropriate delete method. |
You might want to check the NS reports treatments section in case the treatment editing and delete functions still work as expected for items older the 4 days. |
@PieterGit, should we remove the |
@Pogman @jpcunningh can one of you PR this change? (and perhaps provide an extra unit test that will test this behaviour?). Please let me know if you can do this soon (and that we merge it with 0.11.2) or that it will take some time (and we'll merge it with 0.12). |
I have tried doing a delete with also giving the date string, but it still did not work. On papertrail I see: So I do give a datestring, and it does not work. |
@tzachi-dar query based deletes work, you have a slash that should not be in there api/v1/devicestatus.json?find[_id]=5c8d8c1517444b00048b4aba&find[created_at]=2019-03-16T23:51:49.138Z |
Misread your comment thinking it was for treatments! For devicestatus it should be the same but I'm only certain for treatments. |
@tzachi-dar, are you able to test PR #4481? I believe it will allow you to delete a record by _id without requiring a date. |
Thanks for the answers: It now seems that I can delete things while specifying both datestring and id. For example the following line works: @jpcunningh I'll try to check your pr tonight, although I think that specifying the date-string, is a reasonable workaround. |
By the way, a little of toppic for this bug, but I'll still report it here: For example getting by created_at works: Getting by created_at and _id works: Trying to get only by device id does not work. |
OK, seems like with the new code, delete works as expected. For example: this works The problem repeated above was also solved. Thanks for the fast fix. |
Using NS v0.11.1
Deleting treatments from the NS db with the http DELETE --> https://xxxxxxxx.herokuapp.com/api/v1/treatments/5c7ff3a24d6b7ce7ffe84284 form works but seems to not actually be deleting treatment items older then a certain period (~4 days) but yet NS api returns as a successful operation.
Testing by reverting to NS v0.10.3 works as expected .
pazaan/600SeriesAndroidUploader#243
The text was updated successfully, but these errors were encountered: