forget-cards-retry-mechanism
Purpose / Description
This PR addresses an issue where users encounter a "card was modified" error while trying to reset a card's progress in AnkiDroid. The error occurs due to a race condition, where the card's state may change between its display and the user's action, leading to inconsistencies.
Fixes
- Fixes https://github.com/ankidroid/Anki-Android/issues/16734
Approach
To mitigate this problem, the solution implements an iterative mechanism that handles the potential race condition. The code now iteratively checks and updates the state of each "cardId" in a loop, ensuring that the reset operation is robust against state changes during user interaction.
How Has This Been Tested?
Manual testing was conducted to verify the fix. The testing process is demonstrated in the video linked below, showing the steps to reproduce the issue and confirming that the fix resolves the error.
https://github.com/user-attachments/assets/46f78ffd-fabe-48ed-87d6-22af6e232cdb
Note : The approach maybe be basic but it works. Please let me know if there are other much better approach which can be used.
Checklist
Please, go through these checks before submitting the PR.
- [x] You have a descriptive commit message with a short title (first line, max 50 chars).
- [x] You have commented your code, particularly in hard-to-understand areas
- [x] You have performed a self-review of your own code
- [x] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
- [x] UI Changes: You have tested your change using the Google Accessibility Scanner
Yeah absolutely sorry, that approach doesn't work. I will try to fix it !!
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically