Commit graph

674 commits

Author SHA1 Message Date
Damien Elmes
d089deae5a add the ability to reverse sort order 2011-04-28 09:24:02 +09:00
Damien Elmes
efe6177c7a refactor ordering 2011-04-28 09:24:02 +09:00
Damien Elmes
a13c18cf4b start refactoring find code 2011-04-28 09:24:01 +09:00
Damien Elmes
2dfdfad6f2 update license link 2011-04-28 09:24:01 +09:00
Damien Elmes
8fcc6b3085 gpl3->agpl 2011-04-28 09:24:01 +09:00
Damien Elmes
c5e7756304 ensure model/template gid exists; mark schema modified when group deleted 2011-04-28 09:24:01 +09:00
Damien Elmes
86a7106eab when deleting a group, update cards and facts too 2011-04-28 09:24:01 +09:00
Damien Elmes
673913a2a8 fix group tree when no cards use a group 2011-04-28 09:24:01 +09:00
Damien Elmes
c682080890 make it easier to get media dir; remove tidyHTML() 2011-04-28 09:24:01 +09:00
Damien Elmes
6ed48171fc add a default group to model, add groupName() 2011-04-28 09:24:01 +09:00
Damien Elmes
c799b7c97e include model name in stdmodels; provide ability to get model outside cache 2011-04-28 09:24:01 +09:00
Damien Elmes
84d2f32685 move graph code into stats.py; remove old deck stats 2011-04-28 09:24:00 +09:00
Damien Elmes
0b92423cf7 settings->options, return bool for syncingEnabled 2011-04-28 09:24:00 +09:00
Damien Elmes
11f3de525f groupConf() takes gcid, not gid 2011-04-28 09:23:59 +09:00
Damien Elmes
692fba2ea3 use the deck's groups instead of holding on to a private copy 2011-04-28 09:23:59 +09:00
Damien Elmes
4b9c6fc822 track gcid additions too 2011-04-28 09:23:59 +09:00
Damien Elmes
f75e2af195 use a single group setting 2011-04-28 09:23:59 +09:00
Damien Elmes
2a1355eb16 make the group tree part of the scheduler instead 2011-04-28 09:23:59 +09:00
Damien Elmes
2d00163323 tree grouping; add column to groups so they can remember tags 2011-04-28 09:23:59 +09:00
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
Damien Elmes
2d6e9cc186 shorten some queue options 2011-04-28 09:23:59 +09:00
Damien Elmes
2ca9568196 initial graph code reorganization 2011-04-28 09:23:58 +09:00
Damien Elmes
4ff5b81134 return status of scheduler change 2011-04-28 09:23:57 +09:00
Damien Elmes
843e8f3b33 add routine to grab all css 2011-04-28 09:23:57 +09:00
Damien Elmes
942bf43b52 fix stats
they're running now, but need to be sanity checked to make sure they're doing the right thing
2011-04-28 09:23:57 +09:00
Damien Elmes
4477e21369 make sure we load css on model init 2011-04-28 09:23:57 +09:00
Damien Elmes
2c545cfb1d drop data from renderQA 2011-04-28 09:23:57 +09:00
Damien Elmes
45d1b788ea optimize card q/a generation and model fetching 2011-04-28 09:23:57 +09:00
Damien Elmes
c63b4085c6 add queueless counts; fix special field references on upgrade 2011-04-28 09:23:57 +09:00
Damien Elmes
4e989d98a9 add switch to disable groups without forgetting the selection 2011-04-28 09:23:57 +09:00
Damien Elmes
31a548ee42 add a dirty flag
when we make changes that need to be cleaned up on exit, we mark the deck
dirty so that if we exit without saving, we can clean up on next open
2011-04-28 09:23:57 +09:00
Damien Elmes
ed75e4bee2 refactor cloze deletions and text:field, add forecast
Previously cloze deletions were handled by copying the contents of one field
into another and applying transforms to it. This had a number of problems:
- after you add a card, you can't undo the cloze deletion
- if you spot a mistake, you have to edit it twice (or more if you have more
  than one cloze for a sentence)
- making multiple clozes requires copying & pasting the sentence multiple
  times
- this also lead to much bigger decks if the sentences being cloze-deleted are
  large
- related clozes can't be spaced apart as siblings

To address these issues, we introduce the idea of cloze tags in the card
template and fields. If the template has the text:

{{cloze:1:field}}

And a field has the following contents:

{{c1::hello}}

Then the template will automatically replace that part of the text with either
occluded text, or a highlighted answer. All other clozes in the field are
displayed normally.

At the same time, we add support for text: into the template library, instead
of manually creating text: fields in the dict for every field.

Finally, add a forecast routine to get the due counts for the next week, which
is used in the GUI.
2011-04-28 09:23:56 +09:00
Damien Elmes
8705085200 update latex support 2011-04-28 09:23:56 +09:00
Damien Elmes
eb18460945 save creation time in deck flush, update cutoff on reset not deck load 2011-04-28 09:23:56 +09:00
Damien Elmes
ccc325f87b remove utcOffset; make it a property of crt instead 2011-04-28 09:23:56 +09:00
Damien Elmes
138d9881d3 add the ability to limit a cram to a given period 2011-04-28 09:23:56 +09:00
Damien Elmes
be045d451c remove the media table
The media table was originally introduced when Anki hashed media filenames,
and needed a way to remember the original filename. It also helped with:
1) getting a quick list of all media used in the deck, or the media added
   since the last sync, for mobile clients
2) merging identical files with different names

But had some drawbacks:
- every operation that modifies templates, models or facts meant generating
  the q/a and checking if any new media had appeared
- each entry is about 70 bytes, and some decks have 100k+ media files

So we remove the media table. We address 1) by being more intelligent about
media downloads on the mobile platform. We ask the user after a full sync if
they want to look for missing media, and they can choose not to if they know
they haven't added any. And on a partial sync, we can scan the contents of the
incoming facts for media references, and download any references we find. This
also avoids all the issues people had with media not downloading because it
was in their media folder but not in the media database.

For 2), when copying media to the media folder, if we have a duplicate
filename, we check if that file has the same md5, and avoid copying if so.
This won't merge identical content that has separate names, but instances
where users need that are rare.
2011-04-28 09:23:56 +09:00
Damien Elmes
bd477de1a9 implement cram
still to do:
- altering intervals at cram exit
- tidying up
2011-04-28 09:23:56 +09:00
Damien Elmes
22a72d82c6 give card types a more logical order
they are now 0=new, 1=learning, 2=due, to reflect the natural progression
2011-04-28 09:23:56 +09:00
Damien Elmes
6f5918e8cd move reset etc code into sched 2011-04-28 09:23:56 +09:00
Damien Elmes
be56912caf strip all the old cram code; add way to start cramming from deck 2011-04-28 09:23:56 +09:00
Damien Elmes
17f3cabc25 more unit tests, and unbury on close 2011-04-28 09:23:56 +09:00
Damien Elmes
908dccc2c0 implement new review code, add unit tests
Instead of the old approach to sibling spacing, we instead try to pick a due
date that doesn't have any siblings.
2011-04-28 09:23:56 +09:00
Damien Elmes
4a6b5c9105 generate the counts separately, so they're not limited by queueLimit
this has a negative performance impact on decks with many new cards or reviews
due, but we can't limit the counts to 200 without annoying people
2011-04-28 09:23:55 +09:00
Damien Elmes
96f36e66f7 parse tags when creating fact, add selective study, fix emptyAns default 2011-04-28 09:23:55 +09:00
Damien Elmes
ba09529e34 speed up the revlog migration, tweak db handling
remove the unnecessary transaction magic; we just needed to make sure to
lock again after undo is initialized
2011-04-28 09:23:55 +09:00
Damien Elmes
17ee7757de add some group utilities 2011-04-28 09:23:55 +09:00
Damien Elmes
f9c3b27e5d give facts a group, so that cards can have their group reset if necessary 2011-04-28 09:23:55 +09:00
Damien Elmes
945e5e9da8 fix upgrade code for the lock hack 2011-04-28 09:23:55 +09:00
Damien Elmes
9226922af8 properly lock the DB 2011-04-28 09:23:55 +09:00