Damien Elmes
e14198fad7
fix comment and add basic unit test
2020-12-28 13:14:49 +10:00
Arthur Milchior
98d0136921
Trim the start of field name if it is #, /, ^ or a whitespace
...
I actually need to trim whitespace again to deal with a field name of the form "# foo"
2020-12-28 03:32:05 +01:00
abdo
29d17bf608
Ensure non-empty names
...
https://github.com/ankitects/anki/pull/801/
2020-10-22 16:11:06 +03:00
abdo
69da22a2b9
Strip double quotes from names
...
Strip double quotes from all kinds of names
https://github.com/ankitects/anki/pull/798
2020-10-21 21:48:49 +03:00
Damien Elmes
7f42500e53
rename some card+note fields in backend
2020-09-01 10:24:38 +10:00
Damien Elmes
2e7ecfb1d2
allow setting sort field before add
2020-08-17 19:44:09 +10:00
Damien Elmes
a4c8825aeb
show ordinal if card template missing
2020-08-10 13:41:22 +10:00
Damien Elmes
55891fc8f7
clearer message when template error is preventing save
2020-07-29 12:53:03 +10:00
Damien Elmes
f5694a7e4a
migrate card stats to backend
...
Currently this renders the HTML directly like the previous Python
implementation - doing it in JS would probably make more sense in the
future.
2020-06-15 17:22:16 +10:00
Damien Elmes
cb7d78dde5
"Template" special field should have been called "Card"
2020-06-02 16:47:30 +10:00
Damien Elmes
a3e5068952
add some syncing tests - please see alpha2 notes before syncing
2020-06-01 19:44:25 +10:00
Damien Elmes
c78e8425aa
automatically omit notes or cards table when possible
2020-05-19 11:27:02 +10:00
Damien Elmes
e6379bc4d0
update current note type in backend
2020-05-17 20:01:16 +10:00
Damien Elmes
e230f360e9
ensure notetype name unique on add as well
2020-05-17 19:41:47 +10:00
Damien Elmes
a682865169
move deck config to protobuf
2020-05-17 13:28:41 +10:00
Damien Elmes
91e71ae044
show (Deck) when card hasn't been added
2020-05-15 15:01:28 +10:00
Damien Elmes
8dcb7fd2ba
check for empty cloze cards when rendering as well
2020-05-14 21:56:45 +10:00
Damien Elmes
6dd31341f8
add "fill empty" checkbox
2020-05-14 20:58:45 +10:00
Damien Elmes
257e893d95
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
14c0a5891b
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
a95fbe73c3
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
9c3f982c3b
return resolved deck to facilitate random order mode
2020-05-12 21:13:34 +10:00
Damien Elmes
d7f9bccd1e
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
5d493b6ab8
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
0a87b1ef2c
support disabling unicode normalization in notes
2020-05-12 21:13:34 +10:00
Damien Elmes
85528cabc5
use backend for genCards() and updateFieldCache()
2020-05-12 21:13:34 +10:00
Damien Elmes
ad1c519d1c
move find&replace to backend
2020-05-12 21:13:34 +10:00
Damien Elmes
3abd72564a
fix sort field check on save
2020-05-12 21:13:33 +10:00
Damien Elmes
e32be05451
catch attempts to overwrite notetype with older version
2020-05-12 21:13:33 +10:00
Damien Elmes
24ef0cc6f1
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
cbfe20712e
add (currently disabled) check for missing/empty decks on card add
2020-05-12 21:13:33 +10:00
Damien Elmes
8481d224d6
remove notetype from cache when removing
2020-05-12 21:13:33 +10:00
Damien Elmes
22440f32d7
remove :{} and leading/trailing whitespace from field names on save
2020-05-12 21:13:33 +10:00
Damien Elmes
d812853656
sort empty cards by notetype name
2020-05-12 21:13:33 +10:00
Damien Elmes
ed4c75c6c1
don't include non-empty notes in the list
2020-05-12 21:13:33 +10:00
Damien Elmes
21d7df9473
empty card handling
2020-05-12 21:13:33 +10:00
Damien Elmes
4cc070a240
note type removal
2020-05-12 21:13:33 +10:00
Damien Elmes
7106af61ff
update template on field removals as well
2020-05-12 21:13:33 +10:00
Damien Elmes
3b07885911
handle changed sort field index
2020-05-12 21:13:33 +10:00
Damien Elmes
549f98340a
update template when fields renamed
2020-05-12 21:13:33 +10:00
Damien Elmes
8dad5cc3ab
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
6578767c4e
only compare to previous note type if it exists
2020-05-12 21:13:33 +10:00
Damien Elmes
b7bfe57de1
adjust sort index on save
2020-05-12 21:13:33 +10:00
Damien Elmes
c8cbc13bba
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
f95fe72795
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
eaecfca7d1
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
db09122ec5
use default deck for new note types
2020-05-12 21:13:33 +10:00
Damien Elmes
9451d0e9ef
cloze generation
2020-05-12 21:13:33 +10:00
Damien Elmes
d810ba5db9
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
0c8763edf3
cache notetypes
2020-05-12 21:13:33 +10:00