Commit Graph

447 Commits

Author SHA1 Message Date
Damien Elmes
ea4f150455 fetch timing_today() params in backend 2020-05-12 21:13:34 +10:00
Damien Elmes
eee0d7e92f switch server back into a bool and rely on config 2020-05-12 21:13:34 +10:00
Damien Elmes
2c7900989c fix default rollover 2020-05-12 21:13:34 +10:00
Damien Elmes
8af475ac6f add tests for the other checks, and fix new card due limiting 2020-05-12 21:13:34 +10:00
Damien Elmes
9b1eee85d5 rename SortMode arg to match enum 2020-05-12 21:13:34 +10:00
Damien Elmes
2b47e544a8 add tests for card fixes; implement deck recovery 2020-05-12 21:13:34 +10:00
Damien Elmes
5ec7251f6e stop using memory for sqlite temp store
On large collections this can end up consuming hundreds of megabytes
of RAM on operations like a vacuum.
2020-05-12 21:13:34 +10:00
Damien Elmes
70cc1699a6 rewrite DB check
- notes with wrong field count are now recovered instead of
being deleted
- notes with missing note types are now recovered
- notes with missing cards are now recovered
- recover_missing_deck() still needs implementing
- checks required
2020-05-12 21:13:34 +10:00
Damien Elmes
4c9b6be832 fetch notes in nid order
May reduce the amount of seeking on conventional disks. Chunking and
fetching batches of notes at once would improve things further, at the
cost of more memory use.
2020-05-12 21:13:34 +10:00
Damien Elmes
2413f286b1 bulk tag add/remove/update; canonify on note save
also remove the tag list updated hook - we'll need a better solution in
the future than having the library code call back into the GUI code
2020-05-12 21:13:34 +10:00
Damien Elmes
389b8a0536 add the Extra field back to cloze deletions as "Back Extra"
Originally removed because some users were adding cloze deletions to
it, but removing it just replaced that problem with a new problem where
users add the field but don't add it to their card templates.
2020-05-12 21:13:34 +10:00
Damien Elmes
7bab99d873 support disabling unicode normalization in notes 2020-05-12 21:13:34 +10:00
Damien Elmes
a7a485d550 use backend for genCards() and updateFieldCache() 2020-05-12 21:13:34 +10:00
Damien Elmes
1852e32183 update find&replace in browser
sadly the UI still stutters on large selections - the calls
to get the selected rows from Qt are really slow.
2020-05-12 21:13:34 +10:00
Damien Elmes
8b557ec382 move find&replace to backend 2020-05-12 21:13:34 +10:00
Damien Elmes
51bdbdb414 properly handle negated conditionals outside of req generation 2020-05-12 21:13:34 +10:00
Damien Elmes
2308b136fd add an index on notes(mid) so we can avoid the tablescan 2020-05-12 21:13:34 +10:00
Damien Elmes
996d408695 fix sort field check on save 2020-05-12 21:13:33 +10:00
Damien Elmes
5ff83fad08 catch attempts to overwrite notetype with older version 2020-05-12 21:13:33 +10:00
Damien Elmes
238441f2d9 use the backend for the deck due tree
- approx 3x faster on a large test deck
- counts are no longer capped to 1000 in the tree
2020-05-12 21:13:33 +10:00
Damien Elmes
5fb5338d97 add missing decks in backend
- need to compare parents with unicode case folding
- duplicate check enforced by the DB
2020-05-12 21:13:33 +10:00
Damien Elmes
67421e02ec add browserCollapsed as part of tree build 2020-05-12 21:13:33 +10:00
Damien Elmes
a88bc1e836 speed up browser load by rendering deck tree in Rust and skipping counts 2020-05-12 21:13:33 +10:00
Damien Elmes
5cefece264 switch primary key to deck id 2020-05-12 21:13:33 +10:00
Damien Elmes
8d17edc1e6 rework aux table sorting
Instead of inserting text into the aux table and sorting on the fly
(which does a binary sort), we insert the ids in unicase-sorted order,
and then sort based on the automatically assigned rowids - giving
us faster sorts, and proper unicase folding.
2020-05-12 21:13:33 +10:00
Damien Elmes
8246ba148e fix case sensitivity of notetype/template searches 2020-05-12 21:13:33 +10:00
Damien Elmes
3339c404b4 update searching code to use decks table 2020-05-12 21:13:33 +10:00
Damien Elmes
3ffb37270d add partial index on odid, and search odid as well
the odid != 0 check in cards_for_deck.sql is necessary for sqlite
to be able to take advantage of the index
2020-05-12 21:13:33 +10:00
Damien Elmes
f592672fa9 add separate decks table, and start on moving deck handling to Rust
The Python tests are passing, but there are still a number of issues
to work through, and the table/protobuf schema is not yet finalized.
2020-05-12 21:13:33 +10:00
Damien Elmes
36531ea96d add (currently disabled) check for missing/empty decks on card add 2020-05-12 21:13:33 +10:00
Damien Elmes
d3b27c302c split decks into module 2020-05-12 21:13:33 +10:00
Damien Elmes
bb56e9bc20 remove notetype from cache when removing 2020-05-12 21:13:33 +10:00
Damien Elmes
6e1d2990a0 remove unused _updateRequired and associated code 2020-05-12 21:13:33 +10:00
Damien Elmes
8bde0d4ac1 remove :{} and leading/trailing whitespace from field names on save 2020-05-12 21:13:33 +10:00
Damien Elmes
6e8860cafa hook the empty cards code up to the GUI 2020-05-12 21:13:33 +10:00
Damien Elmes
8b0121b0ac sort empty cards by notetype name 2020-05-12 21:13:33 +10:00
Damien Elmes
b476d071e7 don't include non-empty notes in the list 2020-05-12 21:13:33 +10:00
Damien Elmes
5ac3fb5514 handle negative due numbers when gathering existing cards 2020-05-12 21:13:33 +10:00
Damien Elmes
bee0eb1264 empty card handling 2020-05-12 21:13:33 +10:00
Damien Elmes
87cd119216 fix use counts not including unused note types 2020-05-12 21:13:33 +10:00
Damien Elmes
a181d9aa02 note type removal 2020-05-12 21:13:33 +10:00
Damien Elmes
d32935382d update template on field removals as well 2020-05-12 21:13:33 +10:00
Damien Elmes
d6706e1f0e handle changed sort field index 2020-05-12 21:13:33 +10:00
Damien Elmes
ea8e0ef6a2 update template when fields renamed 2020-05-12 21:13:33 +10:00
Damien Elmes
fb578a0c2d switch to owned strings in ParsedTemplate
will make it easier to cache the parsed results in the future,
and handle field renames & other transformations
2020-05-12 21:13:33 +10:00
Damien Elmes
ca5843acea only compare to previous note type if it exists 2020-05-12 21:13:33 +10:00
Damien Elmes
5471f5b1bf adjust sort index on save 2020-05-12 21:13:33 +10:00
Damien Elmes
6cc2bdbf87 start on exposing notes and individual note type methods
changes to note:

- add_note() now takes a provided deck id instead of looking it up
in the notetype
- note type use counts fetched using a single table scan
- make sure note type changes are persisted
- expose optionalness of ords in templates and fields json
2020-05-12 21:13:33 +10:00
Damien Elmes
b89dd32f78 mod schema if field/templates changed
Instead of throwing an error if schema not marked as changed,
just mark it changed, as that way it can be included as part of
the same transaction.
2020-05-12 21:13:33 +10:00
Damien Elmes
f86c2dc567 normal note types now generate a dummy card if required
In the cloze deletion case, we already created a dummy card 0 when
no cloze deletions were found. This change makes normal note types
behave the same way - if no cards would be generated, a dummy card
0 is added to allow the note to be added.

This also applies when modifying note types - it is now possible
to delete card templates even if some notes only use that template,
as a dummy card 0 will be generated for notes that end up with no
cards left.
2020-05-12 21:13:33 +10:00