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
0bb80329e8
ensure collection doesn't get stuck open if loading fails
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
23586ffe90
catch template errors, and start on discarding changes to fields/cards
...
This is only a first step - all the current methods that implicitly
save need to be updated.
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
f637ac957d
hook up new note and note type handling
...
- notetypes are fetched from the DB as needed, and cached in Python
- handle note type changes in the backend. Multiple operations can now
be performed in one go, but this is not currently exposed in the GUI.
- extra methods to grab sorted note type names quickly, and fetch by
name
- col.models.save() without a provided notetype is now a no-op
- note loading/saving handled in the backend
- notes with no valid cards can now be added
- templates can now be deleted even if they would previously
orphan notes
a number of fixmes have been left in notes.py and models.py
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
e0de3d6b8c
add an extra second to a unit test
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
09db596009
rebuild rspy on sql change
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
1ca7fb4a80
use quick check instead of full integrity check on collection close
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