Anki/tests
Damien Elmes e547b0586a simplify undo
The undo code was using triggers and a temporary table to write out all changed rows before making a change. This made for powerful undo/redo support, but had some problems:
- creating the tables and triggers wasn't cheap, especially on mobile devices
- likewise, every data modification required writing into two separate databases, almost doubling the amount of writes required
- it was possible to leave the DB in an inconsistent state if an undoable operation is followed by a non-undoable operation that references the undoable operation, and the user then rolls back the undoable operation.

To address these issues, we simplify undo by integrating it with the autosave changes:
- .save() can be passed a name to mark a rollback point. If the user undoes the change, any changes since the last save are lost
- autosaves happen every 5 minutes, and are pushed back on a .save(), so the maximum work a user can lose is 5 minutes.
- reviews are handled separately, so we can let the user undo multiple reviews at once
- if necessary, special cases could be added for other operations like marking

This means that if a user does two damaging operations in a row they won't be able to restore the first one, but such an event is both unlikely, and is also covered by the backups made each time a deck is opened.
2011-04-28 09:23:59 +09:00
..
off moving scheduling code into separate file, some preliminary refactoring 2011-04-28 09:23:28 +09:00
support remove the media table 2011-04-28 09:23:56 +09:00
__init__.py initial commit from hg 2008-09-27 23:50:03 +09:00
shared.py drop sqlalchemy; massive refactor 2011-04-28 09:23:53 +09:00
test_cards.py wrap the q/a in the card template div 2011-04-28 09:23:57 +09:00
test_deck.py remove utcOffset; make it a property of crt instead 2011-04-28 09:23:56 +09:00
test_find.py parse tags when creating fact, add selective study, fix emptyAns default 2011-04-28 09:23:55 +09:00
test_latex.py update latex support 2011-04-28 09:23:56 +09:00
test_media.py stripMedia->strip 2011-04-28 09:23:58 +09:00
test_models.py wrap the q/a in the card template div 2011-04-28 09:23:57 +09:00
test_sched.py fix collapsing; make sure learning cards are put back on the heap 2011-04-28 09:23:57 +09:00
test_stats.py remove the separate timeGraph() 2011-04-28 09:23:58 +09:00
test_undo.py simplify undo 2011-04-28 09:23:59 +09:00