Commit graph

1856 commits

Author SHA1 Message Date
Damien Elmes
644a885a07 update fact ids, graves
- should never skip recording graves, for the sake of merging
- 1.0 upgrade will fail on decks that have the same fact creation date. need
      to work around this in the future
2011-08-26 21:23:16 +09:00
Damien Elmes
6644c04852 start work on id refactor - models first
The approach of using incrementing id numbers works for syncing if we assume
the server is canonical and all other clients rewrite their ids as necessary,
but upon reflection it is not sufficient for merging decks in general, as we
have no way of knowing whether objects with the same id are actually the same
or not. So we need some way of uniquely identifying the object.

One approach would be to go back to Anki 1.0's random 64bit numbers, but as
outlined in a previous commit such large numbers can't be handled easy in some
languages like Javascript, and they tend to be fragmented on disk which
impacts performance. It's much better if we can keep content added at the same
time in the same place on disk, so that operations like syncing which are mainly
interested in newly added content can run faster.

Another approach is to add a separate column containing the unique id, which
is what Mnemosyne 2.0 will be doing. Unfortunately it means adding an index
for that column, leading to slower inserts and larger deck files. And if the
current sequential ids are kept, a bunch of code needs to be kept to ensure ids
don't conflict when merging.

To address the above, the plan is to use a millisecond timestamp as the id.
This ensures disk order reflects creation order, allows us to merge the id and
crt columns, avoids the need for a separate index, and saves us from worrying
about rewriting ids. There is of course a small chance that the objects to be
merged were created at exactly the same time, but this is extremely unlikely.

This commit changes models. Other objects will follow.
2011-08-26 21:08:30 +09:00
Damien Elmes
9de16289ba always mark gravestones 2011-08-26 17:28:59 +09:00
Damien Elmes
2ae83e6e38 make sure sort field is html stripped in individual edits as well 2011-08-26 17:24:04 +09:00
Damien Elmes
f7b7d46b58 utf8->utf8x in latex preamble 2011-08-26 11:44:41 +09:00
Damien Elmes
91efb8f30b some initial sync work 2011-05-29 08:13:54 +09:00
Damien Elmes
6627264079 delFacts() convenience method; mod schema on model add 2011-05-08 02:12:09 +09:00
Damien Elmes
0af03a6a8a only use deletion log when necessary 2011-05-07 21:45:55 +09:00
Damien Elmes
ec8c720048 make it possible to save with a given mod time, for use in syncing 2011-05-04 23:27:56 +09:00
Damien Elmes
3d370f675b restore the deletion log
the initial plan was to zero the creation time and leave the cards/facts there
until we have a chance to garbage collect them on a schema change, but such an
approach won't work with deck subscriptions
2011-05-04 19:00:38 +09:00
Damien Elmes
f2604b7805 make sure to update new count on new answer 2011-05-04 16:48:53 +09:00
Damien Elmes
6885d89b65 sortCards() when there are no new cards should do nothing 2011-05-04 16:37:31 +09:00
Damien Elmes
a65f241258 gracefully handle invalid queries 2011-04-29 11:46:26 +09:00
Damien Elmes
ddcf83bc7f add [] to cloze 2011-04-29 11:43:06 +09:00
Damien Elmes
a4f644e780 correctly determine period when relying on first day 2011-04-29 11:36:01 +09:00
Damien Elmes
6a93e69fee prevent people from shooting themselves in the foot 2011-04-28 09:31:48 +09:00
Damien Elmes
f969aec03f add created field to models so we can tell if they were originally the same 2011-04-28 09:24:05 +09:00
Damien Elmes
5856ad7545 make latex pre/postamble a model property 2011-04-28 09:24:05 +09:00
Damien Elmes
3327c27d81 only look at the last 10 answers for time 2011-04-28 09:24:05 +09:00
Damien Elmes
0bbdd722c2 very basic eta 2011-04-28 09:24:05 +09:00
Damien Elmes
19fd581839 change default lrn timing; leechAction doesn't need an array 2011-04-28 09:24:05 +09:00
Damien Elmes
754dcef4f7 handle the case where learning cards have a grade higher than their config 2011-04-28 09:24:05 +09:00
Damien Elmes
0d6064b933 rename() 2011-04-28 09:24:05 +09:00
Damien Elmes
47c30f172f fix issues suspending learning cards
- cards in final review are first reset as rev cards so that type==queue and
  they can be restored correctly
- new cards in learning have type set to 1 so they too can be restored
  correctly
2011-04-28 09:24:05 +09:00
Damien Elmes
6946dc2eaa make sure we don't introduce fp due times for learn cards 2011-04-28 09:24:05 +09:00
Damien Elmes
434b5442fd fix unit tests 2011-04-28 09:24:05 +09:00
Damien Elmes
d1deeb2b37 keep track of session reps in scheduler 2011-04-28 09:24:05 +09:00
Damien Elmes
adb600e94d if the user has relearn failed on, show the learn interval 2011-04-28 09:24:05 +09:00
Damien Elmes
add2e0aaa9 give easy an extra day boost 2011-04-28 09:24:05 +09:00
Damien Elmes
2fa767c503 when rescheduling ensure ivl >= 1; remove dead code 2011-04-28 09:24:05 +09:00
Damien Elmes
88c4f010d3 update rescheduling
like forgetCards(), we no longer adjust the stats or revlog for the card
2011-04-28 09:24:05 +09:00
Damien Elmes
8a9174fd4d we don't need rep in the revlog 2011-04-28 09:24:05 +09:00
Damien Elmes
cc0df00fe5 put cards at end when forgetting; drop support for forgetting leeches
forgetCards() needs to know the highest positioned card, and that requires a
full table scan, so it's not appropriate for part of answerCards()
2011-04-28 09:24:04 +09:00
Damien Elmes
5278b3c2bb make sure due is converted to int on upgrade 2011-04-28 09:24:04 +09:00
Damien Elmes
431fd2585e when adding cards, use rand(1, maxfid)
this means that content added earlier has a higher chance of appearing, but it
makes it consistent with sortCards(), and the user can sort manually if need
be
2011-04-28 09:24:04 +09:00
Damien Elmes
c4c1cdeb6b if there are no cards to shift, don't try 2011-04-28 09:24:04 +09:00
Damien Elmes
7acdbfa9ae support for shifting 2011-04-28 09:24:04 +09:00
Damien Elmes
b69031cd4f generalize order/random 2011-04-28 09:24:04 +09:00
Damien Elmes
974324e3dd add unit test for order 2011-04-28 09:24:04 +09:00
Damien Elmes
1641256da4 random ids should start at 1 2011-04-28 09:24:04 +09:00
Damien Elmes
82a3443abe randomize if necessary on upgrade; don't add old option names 2011-04-28 09:24:04 +09:00
Damien Elmes
82c3119c90 update randomizing/ordering code and forgetCards()
instead of completely resetting a card like we did in resetCards() in the
past, forgetCards() just puts the card back in the new queue and leaves the
factor and revlog alone. If users want to complete reset a card, they'll need to
export it.
2011-04-28 09:24:04 +09:00
Damien Elmes
0df95eafc0 revlog updates
- use negative numbers to denote second intervals
- record the rev ivl when leaving lrn queue
- improve revlog upgrade
- don't truncate precision when recording time taken
2011-04-28 09:24:04 +09:00
Damien Elmes
497c25daa4 make it easier for callers to add extra lines 2011-04-28 09:24:04 +09:00
Damien Elmes
466c14421b tweak stats 2011-04-28 09:24:04 +09:00
Damien Elmes
7d64036a07 drop streak, make reps log all entries
reps should now be equal to the number of entries in the revlog, and only
exists so that we can order by review count in the browser efficiently

streak is no longer necessary as we have a learn queue now
2011-04-28 09:24:04 +09:00
Damien Elmes
946b54185e more humane time display 2011-04-28 09:24:04 +09:00
Damien Elmes
58fa7ff714 be consistent with .db references 2011-04-28 09:24:04 +09:00
Damien Elmes
884405d2a6 show the latest review instead 2011-04-28 09:24:04 +09:00
Damien Elmes
5394740ea7 we don't need changed anymore, since it's usually only updated on review 2011-04-28 09:24:04 +09:00