Commit graph

708 commits

Author SHA1 Message Date
Damien Elmes
19a293cf74 don't return a negative delay for failed cards 2011-02-24 13:20:19 +09:00
Damien Elmes
008c5904ca when calculating delay, compare against cutoff, not current time 2011-02-20 13:45:45 +09:00
Damien Elmes
f156f81a84 don't add a mature bonus when cramming 2011-02-09 00:36:16 +09:00
Damien Elmes
8828027729 when calculating next interval ensure we don't have a negative delay 2011-02-09 00:23:45 +09:00
Damien Elmes
8a1df1728f rebuildTypes()
- ensure we're fixing relativeDelay for suspended cards
- remove priority compat code
2011-02-08 02:46:07 +09:00
Damien Elmes
ff38dad5b2 remove redundant code 2011-02-04 20:33:13 +09:00
Damien Elmes
340b5864c8 when deck is finished stop timeboxing timer 2011-02-03 00:18:42 +09:00
Damien Elmes
1464394d58 when the day rolls over, update due cutoffs too, and rebuild queue 2011-02-02 23:52:34 +09:00
Damien Elmes
e49a9bb5ac relative sibling spacing for reviews
Anki 1.0 had a similar feature but we do things a bit differently now. The
relative spacing applies only to reviews, and spaces cards according to their
interval, instead of spacing all cards the same. Any delay < 1 full day is
treated as no delay, so with the default 10% setting, reviews with an interval
< 10 days are not spaced at all. This should hopefully cut down on support
queries for people wondering why many of their cards were delayed, allows the
two settings to be documented separately, and does away with the somewhat
confusing usage of non-integer new sibling values to disable review spacing.
2011-02-02 23:47:58 +09:00
Damien Elmes
66e44f494b don't update factor in cram, learn more, etc 2011-02-02 22:12:06 +09:00
Damien Elmes
338838583e more last interval preservation into cram scheduler code 2011-02-02 22:10:44 +09:00
Damien Elmes
e0d5b9d69e never set lastSync=0 when toggling syncing
we should rely on needFullSync() to determine whether a full sync is actually
necessary.
2011-01-30 15:31:29 +09:00
Damien Elmes
d362decca2 Merge https://github.com/ymasory/libanki 2011-01-30 12:46:13 +09:00
Yuvi Masory
b0b9cd2ce3 suppress indentation 2011-01-29 22:40:29 -05:00
Damien Elmes
ab9451253c now all clients are updated, set delay1 = 0 if 600 2011-01-29 11:01:43 +09:00
Damien Elmes
523adc468e allow user to disable review spacing 2011-01-27 07:45:45 +09:00
Damien Elmes
942307190e catch duplicate tags in upgrade 2011-01-26 15:04:32 +09:00
Damien Elmes
ed5a8b0e3e make sure created is reset 2011-01-26 14:36:45 +09:00
Damien Elmes
be3f32755e new option for tz reset without unpack 2011-01-26 14:32:53 +09:00
Damien Elmes
b533c99375 typo in upgrade code 2011-01-24 09:07:47 +09:00
Damien Elmes
e042ef5e62 make the format upgrading smarter 2011-01-22 07:36:05 +09:00
Damien Elmes
6860bba0de ensure failed mature come at the start of the future day
- this fixes a state where cards failed on that future day could end up
  with an earlier due date that the rest of the failed mature cards, leading
  to the newly failed cards being repeated prematurely
- this leads to non-deterministic scheduling of the mature bonus fails, so
  they are effectively randomized which is probably what most users want
2011-01-21 09:36:04 +09:00
Damien Elmes
4859778d2c preserve old default card-level formatting 2011-01-21 06:41:34 +09:00
Damien Elmes
f945e60d6d when renaming fields, look for the non-space version instead 2011-01-19 05:17:39 +09:00
Damien Elmes
bd7f5787cc fix a bug with relativeDelay not being set on card answer 2011-01-19 01:18:27 +09:00
Damien Elmes
98fb0f5bb9 apply selective study to review early 2011-01-17 01:36:19 +09:00
Damien Elmes
3d5a427f85 fix include&exclude tags case 2011-01-14 23:08:09 +09:00
Damien Elmes
276ec634b9 ignore new cards in hiddenCards() 2011-01-14 19:03:02 +09:00
Damien Elmes
149fbee33e fix new-style template replacement; support cond rendering 2011-01-13 20:00:35 +09:00
Damien Elmes
9b7a55d964 remove some old indices 2011-01-13 19:21:40 +09:00
Damien Elmes
bef86bdbf3 make sure default font sizes are set on upgrade 2011-01-13 06:21:23 +09:00
Damien Elmes
fdd88080c8 work around ankidroid getbool bug 2011-01-13 05:25:05 +09:00
Damien Elmes
3f5befc2e7 don't alter lastSync on upgrade 2011-01-13 04:20:37 +09:00
Damien Elmes
46a441fc0b remove obsolete bulk fetching 2011-01-10 19:26:43 +09:00
Damien Elmes
9af5d4d5ed apply limit to new card count 2011-01-10 18:58:59 +09:00
Damien Elmes
87ffbedf16 remove unused clause in earliestTime() 2011-01-09 15:23:09 +09:00
Damien Elmes
2ca1627add use cardLimit() in cardsDueBy(), not just earliestTime() 2011-01-09 15:13:33 +09:00
Damien Elmes
a4df210667 add group_concat compat code from wm port 2011-01-02 22:17:34 +09:00
Damien Elmes
b235461d8b space cards to next session if per-day off 2011-01-02 17:43:53 +09:00
Damien Elmes
329ab99ff7 add seen card count back for plugins 2011-01-02 13:05:18 +09:00
Damien Elmes
ece9b2eccd don't limit failed cards to 0 when cramming 2010-12-27 21:39:20 +09:00
Damien Elmes
a2606dd70a remove some unused calls 2010-12-26 07:35:20 +09:00
Damien Elmes
9890c77514 update finished screen to use blanket inactive/suspended msg 2010-12-26 07:29:31 +09:00
Damien Elmes
856839e055 include reviews in spaced card count; bold text 2010-12-26 06:01:24 +09:00
Damien Elmes
63106578cd don't decrement due counts when spacing
This works fine if the user is showing all cards, but if they have limited
reviews to certain categories, it can result in the counts going negative
because we decremented for cards which weren't actually due. Determining if a
card was actually due or not is an expensive operation, so instead we leave
the counts alone and make sure reviews will finish early if the new/rev counts
are non-zero but the queue is empty.
2010-12-26 05:54:05 +09:00
Damien Elmes
61812b173d mention syncing disabled case 2010-12-21 23:58:36 +09:00
Damien Elmes
ca07cb8f26 don't dump upgrade notices on stderr if not attached to gui 2010-12-17 04:27:12 +09:00
Damien Elmes
6860f64f28 try to recover tags of card, too 2010-12-17 02:03:35 +09:00
Damien Elmes
5eb00296d5 always space rev cards to the next day 2010-12-17 01:46:14 +09:00
Damien Elmes
7065abcf4f only collapse failed cards after cutoff updated 2010-12-16 22:23:51 +09:00
Damien Elmes
e4447818ff make sure learn more considers inactive cards 2010-12-16 04:28:31 +09:00
Damien Elmes
907fa5c80e tweak spaceCards() 2010-12-15 04:46:40 +09:00
Damien Elmes
0363cc70f4 preserve more of the old formatting on upgrade
because field formatting is always on now, users with custom font
sizes/families set only on the card will still have to alter their templates
and either configure the fields or replace the references with triple
curly braces
2010-12-15 03:52:18 +09:00
Damien Elmes
09b017bb24 not sorting on combinedDue anymore, so don't bother with that upgrade step 2010-12-15 02:03:12 +09:00
Damien Elmes
7ce661ac63 place cards with corrupt/missing facts into new fact instead of deleting 2010-12-13 06:46:20 +09:00
Damien Elmes
0a01d9f867 make latex preamble easier to read 2010-12-13 03:21:05 +09:00
Damien Elmes
d0c6db0d62 only regenerate indices once during upgrade from 1.0 2010-12-13 02:29:21 +09:00
Damien Elmes
d14761b428 sort new cards by due not combinedDue; index optimizations
- ensure queue filling selects can be satisfied by index alone
- sort by due instead of combinedDue so we can decouple card order from
  new spacing
2010-12-13 02:25:39 +09:00
Damien Elmes
5de6bb57ed auto-analyze when we've updated a dynamic index 2010-12-13 00:26:34 +09:00
Damien Elmes
cc8dbccf38 don't set combinedDue twice in answerCard 2010-12-12 00:09:40 +09:00
Damien Elmes
7ab5a53e38 remove superfluous 0 2010-12-11 17:02:51 +09:00
Damien Elmes
35fd3de6fb reset if there were buried cards, since updatePriorities() doesn't 2010-12-11 15:55:22 +09:00
Damien Elmes
f42a2e4a00 rebuild q/a cache to include latex 2010-12-11 02:17:00 +09:00
Damien Elmes
70eb44bce2 latex improvements
- move latex preamble into a deck var and include amsmath by default
- include the pre/postamble in the hash, so changes to the preamble result in
  newly generated images
2010-12-11 02:05:00 +09:00
Damien Elmes
4d2d9eab81 generate latex at fact modification, not review
- latex now slots in to the formatQA hook to render images in the q/a
- moved call() to utils
- cache/uncache latex have been obsoleted. User can delete manually, and
  images will be regenerated with a DB check
2010-12-11 01:40:49 +09:00
Damien Elmes
0c9672e7b8 rewrite media support
- media is no longer hashed, and instead stored in the db using its original
  name
- when adding media, its checksum is calculated and used to look for
  duplicates
- duplicate filenames will result in a number tacked on the file
- the size column is used to count card references to media. If media is
  referenced in a fact but not the question or answer, the count will be zero.
- there is no guarantee media will be listed in the media db if it is unused
  on the question & answer
- if rebuildMediaDir(delete=True), then entries with zero references are
  deleted, along with any unused files in the media dir.
- rebuildMediaDir() will update the internal checksums, and set the checksum
  to "" if a file can't be found
- rebuildMediaDir() is a lot less destructive now, and will leave alone
  directories it finds in the media folder (but not look in them either)
- rebuildMediaDir() returns more information about the state of media now
- the online and mobile clients will need to to make sure that when
  downloading media, entries with no checksum are non-fatal and should not
  abort the download process.
- the ref count is updated every time the q/a is updated - so the db should be
  up to date after every add/edit/import
- since we look for media on the q/a now, card templates like '<img
  src="{{{field}}}">' will work now
- export original files as gone as it is not needed anymore
- move from per-model media URL to deckVar. downloadMissingMedia() uses this
  now. Deck subscriptions will have to be updated to share media another way.
- pass deck in formatQA, as latex support is going to change
2010-12-11 01:19:31 +09:00
Damien Elmes
27ca04fab6 support a media prefix 2010-12-09 15:34:01 +09:00
Damien Elmes
84a98550f0 always change cwd to media dir 2010-12-09 12:55:00 +09:00
Damien Elmes
1bbffec0d6 abort download missing media early; remove obsolete forceMediaDir 2010-12-09 12:53:01 +09:00
Damien Elmes
e5d9697d28 don't break older clients with new delay1 setting 2010-12-09 12:00:00 +09:00
Damien Elmes
cdac2bf8d7 workaround card ordering bug from older versions 2010-12-09 10:43:45 +09:00
Damien Elmes
3491a5e378 add an index for modified to speed up sync.summary()
testing indicates this can produce a 2x performance improvement on lastSync=0,
and much more for partial syncs
2010-12-08 15:59:16 +09:00
Damien Elmes
fe97616ecd add temporary index for priority 2010-12-08 15:38:06 +09:00
Damien Elmes
05f60c49c8 add rebuild arg for minimal startup
this bypasses rebuilding the queue and other startup initialization and thus
loads the deck considerably faster. This is useful when you want to perform
operations on the deck like syncing, but don't need the ability to review
cards
2010-12-08 15:28:28 +09:00
Damien Elmes
9f91e904b2 re-enable locked check 2010-12-07 17:18:17 +09:00
Damien Elmes
1a5c8d2435 fix from marcus for "field":value search 2010-12-07 17:13:25 +09:00
Damien Elmes
0194296839 failed cards at end if !delay0 && !failedCardMax 2010-12-07 16:55:03 +09:00
Damien Elmes
2a8ef89ee5 remove unused binding 2010-12-07 07:26:33 +09:00
Damien Elmes
a2cd19f49a tell users how they can disable the move check 2010-12-05 17:43:54 +09:00
Damien Elmes
7dd57887d0 update learn more for new spacing 2010-12-02 06:48:45 +09:00
Damien Elmes
b5dd8a9f4b update cram code for new spacing 2010-12-02 06:47:16 +09:00
Damien Elmes
bac4acdaa8 reworked handling of spaced cards; add cms argument to previewFact()
- obsolete spaceUntil - it serves no useful purpose
- the old per-model spacing variables are obsolete, as the new approach
  requires uniform spacing across all models for new cards
- introduce a new per-deck variable: newSpacing
- don't fill new queue if we've done today's cards
- still need to check cramming / review early

newSpacing is a time in seconds to delay introduction of sibling new cards.
It can be applied as many times as necessary as there is no harm in new cards
being delayed repeatedly. Because the default queue length is 200 and it can
take quite some time for the spaced cards to be placed in the queue again, we
use a separate array to track spaced new cards provided the configured delay
is less than 20 minutes. At times under 20 minutes this number is not a
guaranteed minimum spacing - if the new card queue is empty the spaced cards
will be flushed before checking the new queue again, as otherwise we end up
trying to fill on every repetition. The due counts no longer decrease by more
than one if the spacing is less than the due cutoff, since that confused some
users.

Review cards are now placed at the end of the current review queue, and will
never be rescheduled to a different day. The old approach had a number of
problems:

- the more card models you had, the more likely a card would be spaced
  multiple times, resulting in you forgetting the card before you get a chance
  to review it
- spacing was applied even if the due card was already late
- repeatedly failing one card over a period of days or weeks would also stave
  the other cards of attention
2010-12-02 06:33:40 +09:00
Damien Elmes
53fbc9b3ee if spacing is disabled, don't decrement counts 2010-12-01 02:54:21 +09:00
Damien Elmes
bb901dfa16 make sure all fields have a font set 2010-12-01 02:42:13 +09:00
Damien Elmes
9fed5e2bc1 work around sqlalchemy problem 2010-12-01 01:21:05 +09:00
Damien Elmes
ae388595da add whitespace preservation flag; only show active card models when previewing 2010-11-30 03:28:08 +09:00
Damien Elmes
a5af8fb8e9 convert pystache to private library since it doesn't behave like upstream 2010-11-29 22:51:55 +09:00
Damien Elmes
b349a96fa5 drop most of the per-card formatting 2010-11-29 22:27:19 +09:00
Damien Elmes
255deb9e9e elaborate on debug msg 2010-11-28 18:14:09 +09:00
Damien Elmes
850d883ab4 update rest of code to recognize&use new rendering 2010-11-28 02:26:53 +09:00
Damien Elmes
f247133ed8 make syncName work with foreign chars 2010-11-27 13:14:16 +09:00
Damien Elmes
ca9aeaa086 don't allow mature delay over a week for now; fix delay being reset to 0 2010-11-26 23:35:26 +09:00
Damien Elmes
3aa787a146 remove print statement 2010-11-26 03:39:58 +09:00
Damien Elmes
00087ed101 find duplicates support 2010-11-26 03:26:02 +09:00
Damien Elmes
d539018137 support multiple facts in fid: query 2010-11-26 03:25:32 +09:00
Damien Elmes
367143f4f3 make sure to set cards as not due when resetting/rescheduling for old clients 2010-11-26 01:49:10 +09:00
Damien Elmes
dd00d1a5e1 when rebuilding tag priorities, don't include obsolote suspended 2010-11-25 21:56:08 +09:00
Damien Elmes
8f18299cc5 typo 2010-11-24 05:39:06 +09:00
Damien Elmes
f698481c19 don't keep changing the hard interval on load
only adjust it if it looks like the defaults haven't been changed
2010-11-24 05:32:09 +09:00
Damien Elmes
6bdca8b3c6 fix available card limiting when using %(tags)s, %(cardModel), etc 2010-11-24 05:14:07 +09:00
Damien Elmes
7491cfc521 new syncName handling
- the local deck name must now match the online deck
- syncName is a hash of the current deck's path or None
- the hash is checked on deck load, and if it is different (because the deck
  was copied or moved), syncing is disabled. This should prevent people from
  accidentally clobbering their online decks
2010-11-23 23:12:34 +09:00
Damien Elmes
6ec898ca4b Require explicit reset for most queue-modifying functions
When you call operations like deleteCards(), suspendCards() and so on, it is
now necessary to call deck.reset() afterwards. This allows the calling code to
delay a reset if necessary. If the calling code calls a function that says the
caller must reset, the caller should be sure to call .reset() and fetch the
current card again. Failure to do the latter will result in answerCard()
attempting to remove the card from the queue, when the queue has been cleared.
2010-11-23 17:41:36 +09:00
Damien Elmes
943c9a0e5f make sure the finished message displays cards due tomorrow 2010-11-23 15:33:54 +09:00
Damien Elmes
03503cd9b9 fix cram from ids case 2010-11-22 08:09:20 +09:00
Damien Elmes
b03f30c279 no need to adjust hardInterval in upgrade; handled in deck open 2010-11-21 14:24:46 +09:00
Damien Elmes
76135dc8be updated failed card handling when cramming
- temp suspend all answered cards, regardless of type
- fails influence the standard scheduling too
2010-11-21 13:39:28 +09:00
Damien Elmes
937d6a6513 update earliestTime() for new failed cards handling 2010-11-21 12:32:58 +09:00
Damien Elmes
b4493f0ec8 user may set young delay to more than a day 2010-11-21 12:25:54 +09:00
Damien Elmes
c2f2225b7f update combinedDue for the current card object, not just for the db 2010-11-16 11:27:27 +09:00
Damien Elmes
0afec850c0 on second thought, avoid suspended cards or this will bite us in the future 2010-11-15 14:29:52 +09:00
Damien Elmes
1cd5125d4e remove the rest of the obsolote rebuildTypes() code 2010-11-15 14:27:52 +09:00
Damien Elmes
26470c997e remove unused where clause from rebuildTypes() 2010-11-15 14:07:13 +09:00
Damien Elmes
6d2e32e2df finished message should use cutoff + 24hrs 2010-11-14 08:16:07 +09:00
Damien Elmes
6f8a5d6a24 fix wrong priority code in rebuildTypes() 2010-11-14 08:11:28 +09:00
Damien Elmes
1f8adc791a a few failed cards related fixes
- make sure cardLimit() matches on sql statements that are broken over lines
- fix logic in getCardId()
- don't increment failed count if delay1>0 and card was mature
2010-11-13 21:39:52 +09:00
Damien Elmes
7502fba5ce change failed card handling
The old delay1 behaviour isn't easy to achieve with the queue code, as we only
refresh the queue when it's emptied, and if the user has delay1 set to say 9
hours, failed mature cards sitting in the queue could prevent subsequent young
failures from being displayed. Instead we convert delay1 to a count in days in
which to offset failed mature cards. 0 means the same time as delay0, 1 means
show the card a day later, and so on. This means users will lose the ability
to delay mature cards for x number of minutes more than young cards, but a
scan of AnkiOnline decks indicates that's not often done.

We also need to use a separate cutoff for failed cards, since we need to be
able to display them as they expire if the user has disabled per-day
scheduling.

And instead of marking cards as due in the future, we set their due time to
the current time, and move the delay0 calculation to getCardId(). This means
that if the user changes their failed card settings from say 1 hour to 10
minutes, the changes apply to the currently failed cards and not just cards
failed in the future.
2010-11-13 21:15:41 +09:00
Damien Elmes
b69fd48768 more type handling updates; don't munge counts on sync
In various parts of the code we need to get all cards of a given category
(new, failed, etc) regardless of whether they're suspended, buried, etc. So we
store the true type in the obsolete relativeDelay column and add in index for
it, because it's cheaper than putting indices on reps & successive.
2010-11-13 18:39:24 +09:00
Damien Elmes
268d2645fd delete cards that have the wrong card model 2010-11-13 16:33:39 +09:00
Damien Elmes
274017036a add sanity limits to cutoff calculation 2010-11-13 12:00:01 +09:00
Damien Elmes
919353c57d only require due to be past cutoff if the card was passed 2010-11-12 12:51:53 +09:00
Damien Elmes
3a7f343464 fix typo - been writing too much javascript lately! 2010-11-12 12:50:07 +09:00
Damien Elmes
1b411938bf add inactive argument to cramCardTags() so it performs like standard 2010-11-12 12:49:30 +09:00
Damien Elmes
9d6b0f35f4 ensure cards are scheduled past cutoff, more
- because the cutoff adds a few hours past midnight, it's possible for a card
  that's scheduled for 1.0 days ahead to fall within the current cutoff, so we
  need to make sure that doesn't happen
- set spaceUntil=0 when answering card again
- fix randomizeNewCards() query. the whole codebase needs auditing for type
  references which need updating
2010-11-07 06:48:35 +09:00
Damien Elmes
61610d8351 adjust some queries so sqlite uses the correct index 2010-11-06 08:57:47 +09:00
Damien Elmes
328a1a86a4 make sure we reset rev early cards too on deck load 2010-11-06 06:03:34 +09:00
Damien Elmes
172505a707 fix broken card type calculation in error msg 2010-11-05 02:40:30 +09:00
Damien Elmes
4c50729946 temp debug info for requeueCard() 2010-11-04 02:32:37 +09:00
Damien Elmes
b766a9164e fix thinko in previous answerCard() update 2010-11-04 02:28:08 +09:00
Damien Elmes
4524fd84fe collapse spacing when cramming 2010-11-04 02:23:15 +09:00
Damien Elmes
cc12c8c573 need to rebuild counts when cutoff updated 2010-11-04 01:51:16 +09:00
Damien Elmes
0535f0561c redundant code in answerCard() 2010-11-03 23:45:44 +09:00
Damien Elmes
3f3f797348 don't space failed cards; make sure card type is calculated after stats update 2010-11-03 00:29:56 +09:00
Damien Elmes
a68334220a fix suspensions 2010-11-02 22:30:57 +09:00
Damien Elmes
73119c93cf restore inactive tags with a more efficient query 2010-11-02 02:33:13 +09:00
Damien Elmes
37c15a320e make sure we don't fail if attempting to reset revearly cards before upgrade 2010-11-02 02:04:54 +09:00
Damien Elmes
2c5ac66083 type/priority changes, cram/rev early refactor, more
* Adjust type to remove cards from the queues, so we don't have to rebuild
  priorities to restore them:

Type -= 3 when suspending
Type += 3 when burying
Type += 6 when cramming / reviewing early

We still need to adjust priorities for backwards compatibility, but this can
be removed in the future.

* Factor out scheduler-specific code in answerCard(), so the different
  schedulers are now fully modular

* Differentiate between a card's current queue and its type

* Make sure dueCutoff cuts off at the chosen offset instead of midnight
2010-11-02 01:59:20 +09:00
Damien Elmes
785ddc3786 make sure to set card limit on scheduler change 2010-10-31 18:59:49 +09:00
Damien Elmes
ce82861357 make sure to update field cache when adding fact 2010-10-31 18:17:49 +09:00
Damien Elmes
c4a1f807ec update cram for new cardActive() handling 2010-10-31 18:12:16 +09:00
Damien Elmes
cc8f619458 remove support for inactive tags
Unlike active tags, they are not able to be implemented efficiently, and they
duplicate the functionality of manually suspending cards
2010-10-29 21:31:40 +09:00
Damien Elmes
2967819882 fix fid queries 2010-10-29 19:41:40 +09:00
Damien Elmes
621d11a6da don't generate cards if the question is blank, again 2010-10-29 01:05:33 +09:00
Damien Elmes
7e6f4907b0 make sure we don't count/grab cards multiple times 2010-10-28 20:33:19 +09:00
Damien Elmes
46ba2db87a use new field cache so we can ignore html in std search 2010-10-27 21:22:29 +09:00
Damien Elmes
731c4100f9 wrap the remaining really long lines 2010-10-27 21:06:45 +09:00
Damien Elmes
4cce768c70 update search code for new scheduler 2010-10-27 21:03:48 +09:00
Damien Elmes
8c7322c974 merge marcus' searching code 2010-10-27 20:54:42 +09:00
Damien Elmes
8ce0ff5b8b add a field cache for searching without html 2010-10-27 19:00:49 +09:00
Damien Elmes
9f9841cb22 use a join instead of a subquery as sqlite can optimize it better 2010-10-26 20:21:59 +09:00
Damien Elmes
c50b7e61cb new indices, make sure to set type when reviewing early
- new type, combinedDue for failed cards & count checks
- only reset() on deck load if not already done
- remove isDue from dynamic indices but leave old ones around for now
2010-10-26 20:10:05 +09:00
Damien Elmes
5bc7c390a0 make sure to respect failed card timing, fix default hard times 2010-10-26 11:46:35 +09:00
Damien Elmes
27b7ccb41f set deck vars before updating the cutoff 2010-10-25 15:46:58 +09:00
Damien Elmes
71de076309 no need to adjust types when rebuilding priorities 2010-10-25 15:38:50 +09:00
Damien Elmes
c1d79b856f superfluous rowcount 2010-10-25 15:36:43 +09:00
Damien Elmes
33e6a17141 make sure to set isDue=0 for spaced cards too, for backwards compat 2010-10-25 15:28:59 +09:00
Damien Elmes
b0e4748a1c make sure to update combinedDue with the new value 2010-10-25 14:35:05 +09:00
Damien Elmes
de18f59474 compat hack for suspended cards on older platforms 2010-10-24 14:21:21 +09:00
Damien Elmes
ecc99780e4 add bury support 2010-10-24 13:06:16 +09:00
Damien Elmes
1d89be0a1e make sure to set isDue=0 when answering a card for compatibility reasons 2010-10-24 13:01:13 +09:00
Damien Elmes
4c76d25b05 remove obsolete 'inactive' from findCards() 2010-10-24 12:55:33 +09:00
Damien Elmes
a3040d1fb4 suspend leeches after they've been removed from the queue 2010-10-24 12:32:40 +09:00
Damien Elmes
fbae42d8ef tweak deck stats for new scheduling 2010-10-24 12:26:18 +09:00
Damien Elmes
1e2d88dccf make sure to consider active tags when calculating next due card 2010-10-24 11:47:47 +09:00
Damien Elmes
057414f404 use same active/inactive limits for failed queue 2010-10-23 16:15:42 +09:00
Damien Elmes
df2ae3b63b give each scheduler a name 2010-10-20 18:03:10 +09:00
Damien Elmes
94ad0cb95e new cram code, remove refs to inactive cards
- cramming is now a separate scheduler type
- correctly answering a card while cramming causes its scheduling to be
  changed in the standard review too
- options to sort cards by earliest modified, ordered, random
- render priority 0 obsolete, as it's all done at queue generation time now
2010-10-20 13:12:17 +09:00
Damien Elmes
30a6f04708 make queue limit configurable, fix bulk fetching of cards for ankionline 2010-10-19 19:45:57 +09:00
Damien Elmes
b7e3d87e5d new active/inactive handling, bigger queues
- separate categories for new & review cards
- 'only these tags' + 'none of these tags'
2010-10-19 19:17:52 +09:00
Damien Elmes
be4dea39b1 more scheduler updates
- reimplement reviewEarly and newEarly by replacing parts of the scheduler,
  instead of adding special conditions
- remove references to isDue and priority (1,2,3,4) which is not necessary
  anymore
- add option to switch between per-day scheduling and due now scheduling
- newCardsToday() -> newCardsDoneToday()
- don't decrement counts for suspended cards
- make sure to update type when suspending/unsuspending
- fix findCards()
- set hardInterval = 1-1.1 on upgrade, or the default per day scheduling doesn't
  make sense
2010-10-18 18:01:19 +09:00
Damien Elmes
ad743d850d start work on scheduling refactor
Previously we used getCard() to fetch a card at the time. This required a
number of indices to perform efficiently, and the indices were expensive in
terms of disk space and time required to keep them up to date. Instead we now
gather a bunch of cards at once.

- Drop checkDue()/isDue so writes are not necessary to the DB when checking
for due cards
- Due counts checked on deck load, and only updated once a day or at the end
of a session. This prevents cards from expiring during reviews, leading to
confusing undo behaviour and due counts that go up instead of down as you
review. The default will be to only expire cards once a day, which represents
a change from the way things were done previously.
- Set deck var defaults on deck load/create instead of upgrade, which should
fix upgrade issues
- The scheduling code can now have bits and pieces switched out, which should
make review early / cram etc easier to integrate
- Cards with priority <= 0 now have their type incremented by three, so we can
get access to schedulable cards with a single column.
- rebuildQueue() -> reset()
- refresh() -> refreshSession()
- Views and many of the indices on the cards table are now obsolete and will
  be removed in the future. I won't remove them straight away, so as to not
  break backward compatibility.
- Use bigger intervals between successive card templates, as the previous
intervals were too small to represent in doubles in some circumstances

Still to do:

- review early
- learn more
- failing mature cards where delay1 > delay0
2010-10-18 14:35:11 +09:00
Damien Elmes
747a28556a when determining which card templates to use, replace text: too 2010-10-18 11:34:02 +09:00
Damien Elmes
4437024ecc fix a bug caused by sqlite not understanding unicode case 2010-08-26 18:38:08 +09:00
Damien Elmes
9332444dfd add hook for when undo is finished 2010-08-16 19:27:00 +09:00
Damien Elmes
84cb81854b faster tag updating for large number of tags 2010-08-16 18:52:55 +09:00
Damien Elmes
f3d2965e12 Revert "don't delete dangling facts when deleting cards" hack
We don't need this any more as we do conflict handling.

This reverts commit 880219567e.
2010-07-21 18:37:35 +09:00
Damien Elmes
880219567e don't delete dangling facts when deleting cards
If the user is not careful to only sync when one side has been modified, they
can end up with cards on one side and not the other. If they then delete a
card, deleting the dangling facts also deletes the fact associated with the
not-yet-synced card. In order to avoid this, we avoid deleting dangling facts
until a DB check.
2010-05-21 06:56:38 +09:00
Damien Elmes
edf121f8dc add hex cache for dumb clients, make sure not to mark deck modified 2010-05-16 01:01:38 +09:00
Damien Elmes
5616e679f5 cache the css as a deck var, don't accidentally send it in sync 2010-05-10 21:32:36 +09:00
Damien Elmes
a1d3f13f0a update for sqlalchemy 0.6 2010-04-21 13:21:16 +09:00
Damien Elmes
1be5943903 remove erroneous comment 2010-04-16 01:25:47 +09:00
Damien Elmes
21ec548680 more explicit setting of creation time, don't fiddle with ordinals for rand 2010-04-15 23:05:14 +09:00
Damien Elmes
783751d7ea support ? for single char search 2010-04-06 18:47:39 +09:00
Damien Elmes
09f51e5028 when adding facts, use a small due increment for each card model 2010-03-03 02:51:05 +09:00
Damien Elmes
80197d9c2f when generating cards, use a small creation date increment 2010-03-03 02:49:55 +09:00
Damien Elmes
220670a048 update combinedDue attr in cardAnswered(), not just on disk 2010-02-22 16:41:20 +09:00
Damien Elmes
472b68b831 don't backup when importing / saving as 2010-02-20 10:03:39 +09:00
Damien Elmes
bc345d3711 create backup dir if missing 2010-02-20 09:54:54 +09:00
Damien Elmes
6dce4e0602 add progress dialog to save as 2010-02-09 01:52:06 +09:00
Damien Elmes
ae690ccea3 don't bother with an integrity check if the deck is unchanged 2010-02-09 01:36:39 +09:00
Damien Elmes
295bacacd8 forget sync name on saveas 2010-02-09 01:30:16 +09:00
Damien Elmes
095a7dbb6f implement save as without attaching a db
Attaching new to old causes old to be implicitly commited.
We also can't access old from new if a write lock has been
taken out, so the only option left is to move all the data
through Python and take the speed hit.
2010-02-09 01:27:49 +09:00
Damien Elmes
dfd88cc4c1 don't set modtime of 0 2010-02-06 01:20:50 +09:00
Damien Elmes
c659660864 don't send acq cards when there are cards to review & new cards shown last 2010-02-05 13:07:42 +09:00
Damien Elmes
09f51e27f0 return newly created card ids when generating cards 2010-02-05 12:59:54 +09:00
Damien Elmes
8378f71c73 since interval is updated first, use lastInterval in cardIsBeingLearnt() 2010-02-01 05:11:34 +09:00
Damien Elmes
9b61d86096 place a minimum bound on average factor
Since SM2's grading has a bias towards starting high and going down (fail/hard
decrease the interval more than easy increases it), more conservative users
find their average interval reaches the minimum allowable interval and the
times given by hard/good start to converge. In the future, the whole concept
of using the average interval for new cards should be revisited to see if the
data supports it
2010-02-01 05:01:23 +09:00
Damien Elmes
d8ba9e1987 revert ease1 change
suspicious of the previous change, I had a look at the example pascal and
found the EF _was_ actually updated on a failure. The spec is misleading there.
2010-02-01 04:44:27 +09:00
Damien Elmes
87a0e087e5 tweak scheduler
- don't touch factor on fail, as per SM2 specs
- hard code no-punish-on-hard 'learning period' to 7 days so users who tweak
  the initial intervals aren't punished too early
2010-02-01 03:28:46 +09:00
Damien Elmes
a6a7782030 fix another windows timer resolution bug 2010-01-22 02:16:57 +09:00
Damien Elmes
33aede4d56 document 'features' reuse, add tool to get var as string 2010-01-19 01:51:35 +09:00