Skip to content
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

Delete, ProfileDelete, and DataDelete API results isSuccessful is true even though delete failed #223

Closed
vestrel00 opened this issue Jun 14, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@vestrel00
Copy link
Owner

vestrel00 commented Jun 14, 2022

Problem

As discovered in #224, Delete, ProfileDelete, and DataDelete API results isSuccessful is true even though delete failed.

Evaluation of delete success is currently,

applyBatch(deleteOperation) != null

This works just fine for update operations where the result is always ContentProviderResult(count=0) even if the update operation succeeded on one or more entities. However, for successful delete operations, the output is ContentProviderResult(count=1). If the entity being deleted is not found or delete failed, then count=0.

Solution

Change evaluation of delete success to,

applyBatch(deleteOperation)?.firstOrNull()?.count?.let { it > 0 } == true

This has the following side effect;

  • Previously, deleting already deleted entities will result in success=true
  • After this issue is fixed, deleting already deleted entities will result in success=false
@vestrel00 vestrel00 added the bug Something isn't working label Jun 14, 2022
@vestrel00 vestrel00 self-assigned this Jun 14, 2022
@vestrel00
Copy link
Owner Author

This is included in release 0.2.2 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant