Damien Elmes
68465ae07b
protobuf tidyups
2020-05-18 09:26:14 +10:00
Damien Elmes
010f0f33b5
use empty buffer if the other map is empty in dconf
2020-05-18 08:12:27 +10:00
Damien Elmes
7ec3f1ecc0
fix syncing
2020-05-17 20:52:02 +10:00
Damien Elmes
803aeff16e
update current note type in backend
2020-05-17 20:01:16 +10:00
Damien Elmes
3cb870ec9c
ensure notetype name unique on add as well
2020-05-17 19:41:47 +10:00
Damien Elmes
7daa417dc8
fix renaming corner cases and decks.update()
...
- .update() should update a single deck and preserve usn by default,
as that's what existing code expects
- decks are automatically renamed when they conflict with an existing
name
2020-05-17 19:07:15 +10:00
Damien Elmes
df48fa8cf7
handle deletion of default deck in backend; use + instead of _
2020-05-17 15:22:19 +10:00
Damien Elmes
b9b837e7bd
update before_upload()
2020-05-17 14:13:21 +10:00
Damien Elmes
6114836484
move deck config to protobuf
2020-05-17 13:28:41 +10:00
Damien Elmes
54670580ad
add option to limit deck tree counts to a particular node
2020-05-17 08:38:49 +10:00
Damien Elmes
da43d22aa5
update rusqlite
2020-05-16 19:49:08 +10:00
Damien Elmes
78a6813b9b
when merging day# in deck, make sure to reset older values
2020-05-16 15:58:25 +10:00
Damien Elmes
efde279588
use the latest day when converting from legacy deck
2020-05-16 14:58:14 +10:00
Damien Elmes
f747063752
add a unit test for deck counts
2020-05-16 14:07:48 +10:00
Damien Elmes
f2086fc2e3
switch to new deck tree in deck browser
...
Saves us having to look up collapsed/filtered as we render, and gives
us type completion.
2020-05-16 10:52:14 +10:00
Damien Elmes
964a69e54e
handle default deck and filtered deck suppression in the backend
2020-05-15 21:21:10 +10:00
Damien Elmes
2ac33500eb
fetch stock notetypes from backend
2020-05-15 17:08:24 +10:00
Damien Elmes
00db72e365
show (Deck) when card hasn't been added
2020-05-15 15:01:28 +10:00
Damien Elmes
24ffb6ab76
check for empty cloze cards when rendering as well
2020-05-14 21:56:45 +10:00
Damien Elmes
782911471b
add "fill empty" checkbox
2020-05-14 20:58:45 +10:00
Damien Elmes
c5d574e9f4
use group box instead of tabs in card layout screen
2020-05-14 17:26:40 +10:00
Damien Elmes
f23eb350e4
drop availOrds(), and use backend for getting cloze numbers
2020-05-14 12:14:00 +10:00
Damien Elmes
6680cdf1d3
update the card layout screen
...
- changes are now committed in bulk when closing the dialog,
and can be canceled
- it's not necessary to save the note to the database to preview it
- duplicate fields are now shown as duplicates in the top list
- redraw preview more quickly
- use + instead of _ when deduplicating names, as the latter is a
glob character
2020-05-13 17:24:49 +10:00
Damien Elmes
12b8fe6147
don't hide static template text when card is empty
2020-05-13 11:17:44 +10:00
Damien Elmes
826cbb0108
fetch template and note fields in backend during normal card render
...
Saves having to serialize the note fields and q/a templates, which
is particularly a win when rendering question/answer in the browse
screen.
Also some work towards being able to preview notes without having to
commit them to the database.
2020-05-13 10:38:49 +10:00
Damien Elmes
9874b19526
handle decks set to random new order
...
It probably makes more sense to randomize on queue build in the future,
but for now this imitates the previous Anki behaviour.
2020-05-12 21:13:34 +10:00
Damien Elmes
7597130145
return resolved deck to facilitate random order mode
2020-05-12 21:13:34 +10:00
Damien Elmes
9317cee9ba
handle scheduling preferences in the backend
2020-05-12 21:13:34 +10:00
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
Damien Elmes
5c3e5c672f
use default deck for new note types
2020-05-12 21:13:33 +10:00
Damien Elmes
15ff279a96
cloze generation
2020-05-12 21:13:33 +10:00
Damien Elmes
83bcb084fe
template changes and card generation
...
Cloze cards are not yet supported, missing decks are not handled,
and more testing is still required.
2020-05-12 21:13:33 +10:00
Damien Elmes
c34e3e8096
fix infinite loop on unclosed {{/<%
2020-05-12 21:13:33 +10:00
Damien Elmes
a226f70733
cache notetypes
2020-05-12 21:13:33 +10:00
Damien Elmes
e8f4a75bd5
always fetch full notetype
2020-05-12 21:13:33 +10:00
Damien Elmes
527c8bf867
embed enum to avoid conflicts
2020-05-12 21:13:33 +10:00
Damien Elmes
f75fd5335d
more work towards note adding
...
Still a prototype at this stage - we'll likely want a caching layer
for note types, and I'm not sure of the merit of having fields in
a separate table, since they're almost always required.
2020-05-12 21:13:33 +10:00
Damien Elmes
5d4f9dc3c0
handle legacy syntax in parser instead of modifying original template
...
Simplifies things for the caller, and ensures legacy handling doesn't
get accidentally forgotten
2020-05-12 21:13:33 +10:00
Damien Elmes
f24dc05c8d
the start of note adding, and note type changes
2020-05-12 21:13:33 +10:00
Damien Elmes
7c23deb562
add separate search_notes_only()
2020-05-12 21:13:33 +10:00
Damien Elmes
04f0ea8599
start work on field changes, and add search_cards to col
2020-05-12 21:13:33 +10:00
Damien Elmes
cc297f1dc6
move note db code to storage
2020-05-12 21:13:33 +10:00
Damien Elmes
da29d0fcae
move latex header and styling into separate files
2020-05-12 21:13:33 +10:00
Damien Elmes
a17ddfdccd
native struct for CardTemplate
2020-05-12 21:13:33 +10:00
Damien Elmes
9080f602b1
native struct for NoteField
...
ord is made optional so we can keep track of changes in the future
2020-05-12 21:13:33 +10:00
Damien Elmes
8cfb1fad44
use native struct for NoteType
2020-05-12 21:13:33 +10:00
Damien Elmes
d6646a6db5
expose stock notetypes
2020-05-12 21:13:33 +10:00
Damien Elmes
540892639f
add stock note types in backend
2020-05-12 21:13:33 +10:00
Damien Elmes
7811a04df8
add default note type translations to ftl
2020-05-12 21:13:33 +10:00
Damien Elmes
32bc1e88eb
migrate the schema11 usages to new structs/sql queries
2020-05-12 21:13:33 +10:00
Damien Elmes
e2b978e7cb
move schema11 note type code into separate file
2020-05-12 21:13:33 +10:00