Anki/rslib/src
Damien Elmes 1871b57663 don't put flag changes in the undo queue, and don't bump mtime
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
2022-02-13 16:27:33 +10:00
..
backend Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
card don't put flag changes in the undo queue, and don't bump mtime 2022-02-13 16:27:33 +10:00
card_rendering New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
collection don't put flag changes in the undo queue, and don't bump mtime 2022-02-13 16:27:33 +10:00
config add a builder for Collection 2021-11-06 14:43:41 +10:00
deckconfig V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
decks V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
error Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
media Garbage collect unused Fluent strings (#1482) 2021-11-12 18:19:01 +10:00
notes update to edition 2021 2021-11-18 20:51:10 +10:00
notetype Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
revlog Cap steps (#1548) 2021-12-15 18:46:26 +10:00
scheduler Round calculated Hard days (#1661) 2022-02-13 13:37:52 +10:00
search Optimise searching in (all) fields (#1622) 2022-01-24 20:30:08 +10:00
stats Fix new preview card's position being interpreted as a date (#1577) 2022-01-06 19:52:54 +10:00
storage V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
sync add a builder for Collection 2021-11-06 14:43:41 +10:00
tags fix Clippy lints in Rust 1.57 2021-12-03 19:53:37 +10:00
undo update undo skipping; exclude deck/tag expand/collapse 2021-06-25 09:16:15 +10:00
adding.rs expose undoable config changes to frontend; refresh sidebar 2021-05-21 17:50:41 +10:00
backend_proto.rs Add links.proto and backend module 2021-07-22 10:05:38 +02:00
browser_table.rs New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
cloze.rs Add check for out-of-place/missing clozes 2021-06-12 10:02:21 +02:00
dbcheck.rs Skip new notetype checks when importing apkg 2021-07-28 21:46:51 +02:00
findreplace.rs Remove redundant error mapping (#1593) 2022-01-16 13:46:27 +10:00
i18n.rs drop the legacy enum from rslib, and pass separate module/message idx 2021-03-27 11:56:31 +10:00
latex.rs tidy up Rust imports 2021-04-18 18:38:54 +10:00
lib.rs New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
links.rs fix a link anchor 2021-11-14 11:44:54 +10:00
log.rs tidy up Rust imports 2021-04-18 18:38:54 +10:00
markdown.rs render deck description with markdown; strip images 2021-02-06 15:02:40 +10:00
ops.rs don't put flag changes in the undo queue, and don't bump mtime 2022-02-13 16:27:33 +10:00
preferences.rs allow customization of default search text 2021-06-24 11:24:30 +10:00
prelude.rs Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
serde.rs tidy up Rust imports 2021-04-18 18:38:54 +10:00
template.rs New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
template_filters.rs New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
text.rs Optimise searching in (all) fields (#1622) 2022-01-24 20:30:08 +10:00
timestamp.rs fix test scheduler undo + implement look-ahead 2021-05-14 22:16:53 +10:00
types.rs update scheduling ops 2021-04-06 16:38:42 +10:00
version.rs tidy up Rust imports 2021-04-18 18:38:54 +10:00