ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.57k stars 2.21k forks source link

[2.17.5] "Invalid input: card was modified" while answering card after day cutoff #15889

Open david-allison opened 7 months ago

david-allison commented 7 months ago

I installed AnkiDroid 2.17.5 and I still get this "card modified" error when leaving a card open overnight (unrated) and rate it in the morning.

AnkiDroid Version = 2.17.5 (1c1aa94ec466f37d33fd2f75020d9f9021ac811e)
Backend Version = 0.1.34-anki23.12.1 (23.12.1 1a1d4d5419c6b57ef3baf99c9d2d9cf85d36ae0a)
Android Version = 9 (SDK 28)
ProductFlavor = full
Manufacturer = LGE
Model = LG-H930
Hardware = joan
Webview User Agent = Mozilla/5.0 (Linux; Android 9; LG-H930 Build/PKQ1.190414.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.210 Mobile Safari/537.36
Crash Reports Enabled = true
![Screenshot_20240314-082100](https://github.com/ankidroid/Anki-Android/assets/998258/db43b239-8e98-46f5-9cb2-0e0a99371a92)

Originally posted by @andreas1974 in https://github.com/ankidroid/Anki-Android/issues/12946#issuecomment-1996770201

david-allison commented 7 months ago

Relevant:

david-allison commented 7 months ago

I see 3 possibilities:

andreas1974 commented 7 months ago

Hi again David!

Since the previous solution was mentioned as a hack, I had another suggestion – still a hack, but one that ought to be simpler and not required to run all the time.

[The following part of this message was moved from link]

Quote from previous location:

⚠️ This is a hack, please suggest a better method, happy to rewrite

Thank you, David, for trying to deal with this issue! I do however have another suggestion: Could you add an error handler that just suppresses / ignores this exact error instead, on this place in the code? I guess it would mean one question, at the most, not rated every 24 hours, right? Personally I'd prefer that to code running every second.

"> withCol { sched.dayCutoff } takes 0-5ms on a background thread, I'm not worried about a hit to battery life from this"

Yes, I read you are not worried about the hit to battery life, but if many app programmers argue the same way, running 5 ms code every second, there will eventually be a hit on performance and battery life. That is why I would prefer losing one rated card every day, or getting the same card again (if that is what will happen). I don't mind much getting a question just one extra time a day.

Thanks, Andreas Jansson

david-allison commented 6 months ago

Could you add an error handler that just suppresses / ignores this exact error instead, on this place in the code? I guess it would mean one question, at the most, not rated every 24 hours, right? Personally I'd prefer that to code running every second.

We should diagnose and fix the bug. The code runs every minute.

Yes, I read you are not worried about the hit to battery life, but if many app programmers argue the same way, running 5 ms code every second, there will eventually be a hit on performance and battery life.

If there are alternative APIs which we can use, I'm open to it. We should first be correct. Users shouldn't miss a card

github-actions[bot] commented 2 months ago

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically