1871b57663
This is not ideal, but I struggled to come up with a better solution. Background: - The scheduler records the mtime of cards as it's building the queues, and will throw an error in get_queued_cards() if the card on the DB has a different mtime. This is to catch bugs - any operation that modifies cards should be triggering a queue rebuild, or should adjust the queues appropriately. - The review screen skips the usual queue rebuild redraw, and directly updates the flag icon. This is because a rebuild could cause a different card to appear, or the answer side to switch back to the question side, neither of which the user expects when they flag a card. The current behaviour was broken: the queue rebuilding was still happening on the backend, and the frontend was just failing to reflect it. I initially tried to special-case Op::SetFlag, having it skip the queue rebuild, and having set_card_flag() update the mtimes in the active queue. But those mutations weren't captured by the undo log, so they didn't get undone when undoing the set flag operation. We could perhaps work around it by adding a separate undo entry to capture the mutation, but it started to feel like it would be a pain to maintain moving forward. By skipping the undo queue and retaining the same mtime, no queue rebuild is required. Because we're setting usn, the cards will still sync, but as mtime is not bumped, in the case of a conflict, an older unsynced change from another client may revert the flag change. Fixes https://forums.ankiweb.net/t/anki-2-1-50-beta-1-2/15608/145 |
||
---|---|---|
.. | ||
.cargo | ||
benches | ||
build | ||
cargo | ||
i18n | ||
i18n_helpers | ||
linkchecker | ||
src | ||
tests/support | ||
.gitignore | ||
bench.sh | ||
BUILD.bazel | ||
Cargo.toml | ||
empty.rs | ||
README.md | ||
rustfmt.bzl | ||
rustfmt.toml |
Anki's Rust code.
backend.proto stores the interfaces used to communicate backend messages between Rust, Python and TypeScript.