Commit Graph

1914 Commits

Author SHA1 Message Date
Damien Elmes
633d246306 Don't lock collection while generating TTS 2023-10-26 11:45:17 +10:00
Damien Elmes
ceb8a4ac20 Revert "Use scheduling flag instead of checking revlog when importing decks (#2730)"
This reverts commit e1e0f2e1bd.

The previous change breaks the assumption on this line:

                DeckKind::Filtered(_) => unreachable!(),

This will likely need a bigger refactor to handle this properly, and separate
out importing of deck configs from other scheduling data.
2023-10-26 11:23:24 +10:00
Damien Elmes
35be9a70da Add public method to determine if v3 is enabled 2023-10-25 11:41:05 +10:00
Abdo
14940a617b
Fix IO groups breaking upon editing (#2766)
* Fix IO groups breaking upon editing

* Emit change signal after group/ungroup
2023-10-23 09:43:31 +10:00
Damien Elmes
9bbc6c9405 Add image occlusion to stock notetypes 2023-10-22 11:00:39 +10:00
Aristotelis
26b2ac4ee3
Add ordinals to IO clozes (#2763)
Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-22 10:52:22 +10:00
Damien Elmes
3bfd828503 Fix browser query not matching stats
- Round instead of floor when binning
- Account for rounding in search

https://forums.ankiweb.net/t/anki-23-10-release-candidate/35967/4
2023-10-21 12:00:43 +10:00
Damien Elmes
7942487593 "Notetype" -> "Note Type" in browser column
While we may want to update things in the other direction in the future
(https://github.com/ankitects/anki/pull/1456#issuecomment-951767922),
this is more consistent with the existing other strings

Closes #2754
2023-10-21 11:35:30 +10:00
Gustaf-C
4b6aadfe62
Tweak browser column labels to card type, note type (#2751)
* Tweak browser column labels to card type, note type

* Apply suggestions from code review
2023-10-20 12:46:09 +10:00
Aristotelis
c828a2eb6f
Add APIs for IO card rendering (#2739)
* Refactor: Add index to shapes package

* Add shape draw callback API to setupImageCloze

* Expose IO drawing API, switch away from image cloze naming

We currently use "image occlusion" in most places, but some references to "image cloze" still remain. For consistency's sake and to make it easier to quickly find IO-related code, this commit replaces all remaining references to "image cloze", only maintaining those required for backwards compatibility with existing note types.

* Add cloze ordinal to shapes

* Do not mutate original shapes during (de)normalization

Mutating shapes would be a recipe for trouble when combined with IO API use by external consumers.

(makeNormal(makeAbsolute(makeNormal())) is not idempotent,
and keeping track of the original state would introduce
additional complexity with no discernible performance benefit
or otherwise.)

* Tweak IO API, allowing modifications to ShapeProperties

* Tweak drawShape parameters

* Switch method order

For consistency with previous implementation

* Run Rust formatters

* Simplify position (de)normalization

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-20 09:36:46 +10:00
Sam Waechter
0e24532439
Trim extra colons on conversion to NativeDeckName (#2748)
This fixes issue #2692. Leading/trailing colons are remove along with whitespace so " : : :foo:bar: : : " becomes "foo:bar"
2023-10-19 13:42:57 +10:00
Abdo
bba67fdab4
Fix misleading warning when changing notetype from/to cloze (#2744) 2023-10-18 16:50:32 +10:00
Damien Elmes
39bf2f2160 Update to latest fsrs 2023-10-18 09:03:23 +10:00
Damien Elmes
72e57456ce Fix stuttering in FSRS progress display 2023-10-14 14:03:20 +10:00
Abdo
5cde4b6941
Remove v1/v2 support from the backend (#2727)
* Remove v1/v2 support from deck list

* Remove v1/v2 support from most routines and show error

* Remove scheduler_version from preferences

* Fix formatting

* Remove v1/v2 conditionals from Python code

* Fix legacy importer

* Remove legacy hooks

* Add missing scheduler checks

* Remove V2 logic from deck options screen

* Remove the review_did_undo hook

* Restore ability to open old options with shift (dae)
2023-10-14 10:50:59 +10:00
Damien Elmes
e1e0f2e1bd
Use scheduling flag instead of checking revlog when importing decks (#2730)
Closes #2714
2023-10-14 10:30:20 +10:00
Damien Elmes
003cdfd2ec Use sm2 retention when deriving memory state
Closes #2702
2023-10-13 10:37:35 +10:00
Abdo
9e147c6335
Add text tool to image occlusion (#2705)
* Add text tool to IO

* Remove unnecessary parentheses

* Fix text objects always grouped

* Remove log

* Fix text objects hidden on back side

* Implement text scaling

* Add inverse text outline

* Warn about IO notes with only text objects

This will result in a different error message than the case where no
objects are added at all though, and the user can bypass the warning.
Maybe this is better to avoid discarding the user's work if they have
spent some time adding text.

* Add isValidType

* Use matches!

* Lock aspect ratio of text objects

* Reword misleading comment

The confusion probably comes from the Fabric docs, which apparently need updating: http://fabricjs.com/docs/fabric.Canvas.html#uniformScaling

* Do not count text objects when calculating current index

* Make text objects respond to size changes

* Fix uniform scaling not working when editing

* Use Arial font

* Escape colons and unify parsing

* Handle scale factor when restricting shape to view

* Use 'cloned'

* Add text background

* Tweak drawShape's params
2023-10-12 13:40:11 +10:00
Abdo
c052be9e25
Add a backend method to extract static media references (#2716)
* Add a backend method to extract static media references

* Extract into Notetype.gather_media_names()
2023-10-11 14:10:02 +10:00
Damien Elmes
961d7dfd72 Rust 1.73 2023-10-09 19:22:43 +10:00
Damien Elmes
f741b4af91 Fix 'PanicException: command requires weights to be set' 2023-10-09 18:39:18 +10:00
Damien Elmes
0e6104a96b Fix 'Expression tree is too large' when user has many decks
+ Allow 'did:' searches to match multiple decks at once
2023-10-09 18:39:18 +10:00
Damien Elmes
67acdc3034 Apply tag fix from Abdo
https://forums.ankiweb.net/t/drag-and-drop-tag-groups-crashes-anki/35505/3
2023-10-09 13:55:37 +11:00
RumovZ
23f29a6ecc
Invalid sorting (#2709)
* Rollback if toggling state fails

Previously, if the search triggered by a state toggle failed, the switch
and the model would move to the new state, while the table would remain
in the previous state.

* Fix reversed sort orders of FSRS columns

* Add sep. default sort orders for notes and cards

* Add test for consistent default sort orders

* Add launch config for debugging in VSC

* Extend launch config for macOS and Linux
2023-10-07 06:36:15 +00:00
RumovZ
ba43c7fdc1
Merge all conflicting notetypes (#2707)
* Refactor import apkg tests

* Merge conflicting notetypes regardless of id match

Original ids are a new thing, and we need to handle previous remappings.
This is done separately from the conflict resolution for notetypes with
matching ids, because 1) we need to look at the notes to determine
conflicts, and 2) we don't want to change the notetype of *all* existing
notes with the conflicting notetype. The main reason is that for 2
existing notes with the same noteype, their incoming counterparts could
have *different* notetypes. So to get rid of all conflicts, they must be
resolved on a note-by-note basis.

* Delete merged, now unused notetypes
2023-10-05 06:18:10 +00:00
Damien Elmes
6c1d7a6703 Use 0 when there are no relearning steps; ensure not NaN 2023-10-05 09:55:05 +10:00
Damien Elmes
3636c7c90e When the user has no relearning steps, synthesize the value 2023-10-03 13:50:29 +10:00
Damien Elmes
41bddfc6cb Ensure fuzz doesn't go backwards
Closes #2694
2023-10-03 13:23:27 +10:00
Damien Elmes
72b0c81761 When learning steps are missing, start from the SM-2 state
Closes https://github.com/open-spaced-repetition/fsrs-rs/issues/87
2023-10-03 12:20:10 +10:00
Damien Elmes
257d7bbbbc Update FSRS crate 2023-10-03 11:28:56 +10:00
Damien Elmes
9fd8a8bb40 Add stability graph 2023-10-01 15:44:33 +10:00
Damien Elmes
072cd37b42 Support rescheduling on weight/retention change 2023-10-01 15:20:58 +10:00
Damien Elmes
d16faacd0f Allow cards with no learning history when not training 2023-09-30 16:10:23 +10:00
Damien Elmes
93499d4182 Display the default weights as a placeholder 2023-09-30 16:10:23 +10:00
Damien Elmes
50c8a1ba9f Update FSRS
- up to 10x performance increase in optimal retention
- expose loss aversion
- use SpinBoxes
2023-09-30 16:10:22 +10:00
Damien Elmes
f3bb845961 Update incompatible Rust deps 2023-09-28 10:00:47 +10:00
Damien Elmes
b8390d096e Shift weight calculation to backend so it can be run in parallel 2023-09-28 09:10:54 +10:00
Damien Elmes
1f55ad1d44
Expose the ability to train weights from items (#2687) 2023-09-28 08:28:24 +10:00
Jarrett Ye
05499297e0
Fix first_rating_count & learn_cost (#2688)
* fix first_rating_count & learn_cost

* Update CONTRIBUTORS

* cargo clippy --fix

* cargo fmt
2023-09-27 18:31:40 +10:00
Damien Elmes
0532c1f5b0 Use revlog to determine days_elapsed when studying/for card info
Currently prop searches and the retrievability column will continue to
derive the days from the card only, as it's difficulty to integrate revlog
upgrade lookups into those code paths, especially in a performant way.
One possible way we could solve this in the future is to store last_review_day
in the card data, so we can know it even if the due date has been shifted.
Check DB could fill it in for existing cards.
2023-09-27 16:17:47 +10:00
Damien Elmes
66b944b722 Fix days_since_last_review() when used in filtered deck 2023-09-27 16:17:47 +10:00
Abdo
ab7e64865e
Implement "stop timer on answer" as a preset option (#2686)
* Implement "stop timer on answer" as a preset option

* Hide timer setting on AnkiMobile (dae)
2023-09-27 16:10:14 +10:00
Damien Elmes
ab4e820608 Update FSRS; fix handling of invalid revlogs
State is now inferred from SM-2 data when the revlog is not suitable
2023-09-27 13:13:10 +10:00
Damien Elmes
add6f6f62f Fix invalid utf-8 in tags 2023-09-27 10:06:31 +10:00
Damien Elmes
a1f4bcb3cb Fix optimal retention caps 2023-09-26 14:17:55 +10:00
Abdo
4cf2ab35ab
Match IO extensions in a case-insensitive manner (#2683) 2023-09-26 13:14:59 +10:00
Damien Elmes
bae8038178 Allow desired retention to be set to 0.7
https://github.com/open-spaced-repetition/fsrs-rs/issues/79#issuecomment-1733779005
2023-09-26 13:03:49 +10:00
Damien Elmes
1395f3e5e6 Fix changes_since_open() 2023-09-26 11:02:16 +10:00
Damien Elmes
c9ca5ee6e7 Fix cancel signal being ignored if sent quickly 2023-09-25 16:32:12 +10:00
Damien Elmes
e0399bcad2 Allow cards with no learning history when not training 2023-09-25 15:57:35 +10:00
Damien Elmes
baae685dbb UI tweaks
https://forums.ankiweb.net/t/anki-23-10-beta-1/34912/19
2023-09-25 15:54:18 +10:00
Damien Elmes
bb0acd9d92 Support retrievability calculation for (re)learning cards 2023-09-25 14:58:39 +10:00
Damien Elmes
da0e42ea03 Fix extract_fsrs_retrievabilty()
- Need to use fuzzed interval to accurately determine elapsed days
- saturating_sub on an i32 is not useful
2023-09-25 14:40:44 +10:00
Damien Elmes
e6aaeb85e9 Expose memory state computation to Python
Closes #2676
2023-09-25 11:05:47 +10:00
Damien Elmes
69c4efea8a Use memory state to calculate relative overdueness 2023-09-24 13:07:11 +10:00
Damien Elmes
907a73eb88 When calculating retrievability, use stability instead of fuzzed interval 2023-09-24 12:53:05 +10:00
Damien Elmes
9cc4720efe Support fetching new cards by deck then random note
https://forums.ankiweb.net/t/feature-request-option-for-new-card-gather-order-that-prioritizes-subdecks-closer-to-top-but-gathers-cards-randomly-from-each-subdeck/23178
2023-09-24 11:54:10 +10:00
Damien Elmes
e6fdfc20a9 Use FSRS difficulty when sorting by ease 2023-09-23 16:20:36 +10:00
Damien Elmes
06d99b5871 Allow extracting desired retention 2023-09-23 16:11:35 +10:00
Damien Elmes
2126ff9a16 Gate graph display on fsrs status 2023-09-23 15:59:02 +10:00
Damien Elmes
8b849dd629 Avoid excessive floating point precision when serializing 2023-09-23 15:50:10 +10:00
Damien Elmes
03edb7bf9e Store desired retention in card data
If we want to be able to factor the desired retention into a sort based
on relative overdueness, having the values accessible on the card makes
things easier.
2023-09-23 15:42:42 +10:00
Damien Elmes
c78de23cf9 Convert FSRS to a global option
Allowing some decks to be FSRS and some SM-2 will lead to confusing
behavior when sorting on SM-2 or FSRS-specific fields, or when moving
cards between decks.
2023-09-23 14:41:55 +10:00
Abdo
f78c59176e
Add an option to stop the timer on answer (#2673)
* Add an option to stop the timer on answer

* Fix tab order
2023-09-23 14:01:03 +10:00
Abdo
c2b1ab5eb0
Skip template checks in Fields screen (#2670) 2023-09-20 16:09:54 +10:00
Damien Elmes
b8ec76fb66 Fix crash when using FSRS with a low max interval setting 2023-09-20 13:14:03 +10:00
Damien Elmes
6074865763 Calculate parameters automatically
Logic derived from d8e2f6a0ff

Closes #2661
2023-09-18 16:43:36 +10:00
Sam Waechter
e7bf248a62
Fix unable to save field dialog if certain fields are deleted (#2663)
* Fix unable to save field dialog if certain fields are deleted

Implemented solution suggested in issue #2556

* Fix unable to save field dialog if certain fields are deleted

fixed code formating

* Fix unable to save field dialog if certain fields are deleted

Made new functions to check referencelessness.  Added unit test.
2023-09-18 14:33:56 +10:00
Damien Elmes
a7b4c90146 Use field tags instead of hard-coding occlusion fields
+ Don't protect the comments field

It's not required by our current code. We can remove the protection
from Header and Back Extra in the future too, once we no longer depend
on them.

Closes #2621
2023-09-18 10:10:11 +10:00
Damien Elmes
906a937faf Add tags in DB check 2023-09-17 15:00:28 +10:00
Damien Elmes
f0be697b55 Protect image occlusion fields and cloze field 2023-09-17 14:22:25 +10:00
Damien Elmes
1e37c806e5 Add support for tagging + protecting fields 2023-09-17 14:03:42 +10:00
Damien Elmes
59759b468f Start on a 'get params' button 2023-09-17 12:58:13 +10:00
Damien Elmes
736054a2e4 Fix preset searches, and expose in text search 2023-09-17 12:51:22 +10:00
Damien Elmes
25d5e56397 Clear memory state when user disables FSRS 2023-09-17 11:50:38 +10:00
Damien Elmes
75de1f9709 Record FSRS difficulty in the review log
Will allow user to see a record of difficulty changes, and allows us
to identify reviews that have been done with FSRS vs SM-2, since the
valid range is different.
2023-09-17 11:50:38 +10:00
Damien Elmes
0301ae1d8a fsrs_memory_state -> memory_state 2023-09-17 11:50:38 +10:00
Damien Elmes
5004cd332b
Integrate FSRS into Anki (#2654)
* Pack FSRS data into card.data

* Update FSRS card data when preset or weights change

+ Show FSRS stats in card stats

* Show a warning when there's a limited review history

* Add some translations; tweak UI

* Fix default requested retention

* Add browser columns, fix calculation of R

* Property searches

eg prop:d>0.1

* Integrate FSRS into reviewer

* Warn about long learning steps

* Hide minimum interval when FSRS is on

* Don't apply interval multiplier to FSRS intervals

* Expose memory state to Python

* Don't set memory state on new cards

* Port Jarret's new tests; add some helpers to make tests more compact

https://github.com/open-spaced-repetition/fsrs-rs/pull/64

* Fix learning cards not being given memory state

* Require update to v3 scheduler

* Don't exclude single learning step when calculating memory state

* Use relearning step when learning steps unavailable

* Update docstring

* fix single_card_revlog_to_items (#2656)

* not need check the review_kind for unique_dates

* add email address to CONTRIBUTORS

* fix last first learn & keep early review

* cargo fmt

* cargo clippy --fix

* Add Jarrett to about screen

* Fix fsrs_memory_state being initialized to default in get_card()

* Set initial memory state on graduate

* Update to latest FSRS

* Fix experiment.log being empty

* Fix broken colpkg imports

Introduced by "Update FSRS card data when preset or weights change"

* Update memory state during (re)learning; use FSRS for graduating intervals

* Reset memory state when cards are manually rescheduled as new

* Add difficulty graph; hide eases when FSRS enabled

* Add retrievability graph

* Derive memory_state from revlog when it's missing and shouldn't be

---------

Co-authored-by: Jarrett Ye <jarrett.ye@outlook.com>
2023-09-16 16:09:26 +10:00
Abdo
6f0bf58d49
Add a backend method to add notes in bulk (#2659)
* Add a backend method to add notes in bulk

* i -> idx

* Remove duplicate assignment

* Allow add_notes to work with multiple deck IDs

* Rename note_deck_id to requests
2023-09-16 13:51:32 +10:00
Damien Elmes
30ae9f7c54 Fix merge_undoable_ops() not updating counter 2023-09-15 16:53:00 +10:00
Abdo
e2603a73f5
Fix unescaped HTML in type-in-the-answer (#2658) 2023-09-14 11:34:22 +10:00
RumovZ
850043b49b
Tooltips for CSV import and import page refactoring (#2655)
* Make enum selector generic

* Refactor ImportCsvPage to support tooltips

* Improve csv import defaults

* Unify import pages

* Improve import page styling

* Fix life cycle issue with import properties

* Remove size constraints to fix scrollbar styling

* Add help strings and urls to csv import page

* Show ErrorPage on ImportPage error

* Fix escaping of import path

* Unify ImportPage and ImportLogPage

* Apply suggestions from code review (dae)

* Fix import progress

* Fix preview overflowing container

* Don't include <br> in FileIoErrors (dae)

e.g. 500: Failed to read '/home/dae/foo2.csv':<br>stream did not contain valid UTF-8

I thought about using {@html ...} here, but that's a potential security issue,
as the filename is not something we control.
2023-09-14 09:06:15 +10:00
Damien Elmes
bfef908c6c
Refactor media sync handling (#2647)
* Refactor media sync handling

- The media USN is now returned in sync/meta, which avoids an extra
round-trip.
- Media syncing is now automatically started by the syncing code at
the end of a normal or full sync, which avoids it competing for bandwidth
and resources, and avoids duplicate invalid login messages when the auth
token is invalid.
- Added a new media_sync_progress() method to both check if media is
syncing, and get access to the latest progress.
- Updated the sync log screen to only show the latest line, like AnkiMobile.
- Show media sync errors in a pop-up, so they don't get missed. Use a non-modal
pop-up to avoid potential conflicts with other modals.

* Remove print statement
2023-09-10 13:22:20 +10:00
RumovZ
14de8451dc
Merging Notetypes on Import (#2612)
* Remember original id when importing notetype

* Reuse notetypes with matching original id

* Add field and template ids

* Enable merging imported notetypes

* Fix test

Note should be updated if the incoming note's notetype is
remapped to the existing note's notetype.
On the other hand, it should be skipped if its notetype id is mapped
to some new notetype.

* Change field and template ids to i32

* Add merge notetypes flag to proto message

* Add dialog for apkg import

* Move HelpModal into components

* Generalize import dialog

* Move SettingTitle into components

* Add help modal to ImportAnkiPackagePage

* Move SwitchRow into components

* Fix backend method import

* Make testable in browser

* Fix broken modal

* Wrap in container and fix margins

* Update commented Anki version of new proto fields

* Check ids when comparing notetype schemas

* Add tooltip for merging notetypes.

* Allow updating notes regardless of mtime

* Gitignore yarn-error.log

* Allow updating notetypes regardless of mtime

* Fix apkg help carousel

* Use i64s for template and field ids

* Add option to omit importing scheduling info

* Restore last settings in apkg import dialog

* Display error when getting metadata in webview

* Update manual links for apkg importing

* Apply suggestions from code review

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>

* Omit schduling -> Import all cards as new cards

* Tweak importing-update-notes-help

* UpdateCondition → ImportAnkiPackageUpdateCondition

* Load keyboard.ftl

* Skip updating dupes in 'update alwyas' case

* Explain more when merging notetypes is required

* "omit scheduling" → "with scheduling"

* Skip updating notetype dupes if 'update always'

* Merge duplicated notetypes from previous imports

* Fix rebase aftermath

* Fix panic when merging

* Clarify 'update notetypes' help

* Mention 'merge notetypes' in the log

* Add a test which covers the previously panicking path

* Use nested ftl messages to ensure consistency

* Make order of merged fields deterministic

* Rewrite test to trigger panic

* Update version comment on new fields
2023-09-09 09:00:55 +10:00
Damien Elmes
9595101065 Wrap backend in an outer Arc
Necessary to allow backend commands that run in the background instead
of blocking.
2023-09-07 14:10:50 +10:00
Damien Elmes
ffd392de21
Change Anki's version scheme; bump to 23.09 (#2640)
* Accept iterables as inputs to backend methods

* Shift add-on check to backend; use new endpoint

The new endpoint will return info on a suitable branch if found,
instead of returning all branches. This simplifies the frontend code,
and means that you can now drop support for certain versions without
it also remotely disabling the add-on for people who are running one of
the excluded versions, like in

https://forums.ankiweb.net/t/prevent-add-ons-from-being-disabled-remote-stealthily-surreptitiously/33427

* Bump version to 23.09

This changes Anki's version numbering system to year.month.patch, as
previously mentioned on https://forums.ankiweb.net/t/use-a-different-versioning-system-semver-perhaps/20046/5

This is shaping up to be a big release, with the introduction of FSRS and
image occlusion, and it seems like a good time to be finally updating the
version scheme as well. AnkiWeb has been updated to understand the new
format, and add-on authors will now specify version compatibility using
the full version number, as can be seen here:

https://ankiweb.net/shared/info/3918629684

* Shift update check to backend, and tidy up update.py

* Use the shared client for sync connections too
2023-09-07 12:37:15 +10:00
Damien Elmes
6d34d19808 Drop legacy schema option 2023-09-06 15:49:14 +10:00
Damien Elmes
0c6e3eaa93
Integrate the FSRS optimizer (#2633)
* Support searching for deck configs by name

* Integrate FSRS optimizer into Anki

* Hack in a rough implementation of evaluate_weights()

* Interrupt calculation if user closes dialog

* Fix interrupted error check

* log_loss/rmse

* Update to latest fsrs commit; add progress info to weight evaluation

* Fix progress not appearing when pretrain takes a while

* Update to latest commit
2023-09-05 18:45:05 +10:00
Damien Elmes
fe8cf5ae7d Read csv text in eagerly
This allows us to display a more useful "not utf-8" message, instead of a
generic "invalid csv" message when the metadata can't be fetched.
2023-09-05 18:33:23 +10:00
Damien Elmes
ecaba5e655 Fix stack overflow in request::Error mapping 2023-09-05 15:27:17 +10:00
Abdo
d3d67c2083
Support searching for custom data strings (#2634)
* Add extract_custom_data

* Add tests for has-cd

* Add `prop:cds` query
2023-09-04 11:17:13 +10:00
Damien Elmes
ff53625408 Update nightly formatter
Rustfmt is now capable of formatting let Some(..) else {} blocks
2023-09-02 16:13:50 +10:00
Abdo
064b973a2a
Allow searching for missing custom data properties (#2626)
* Allow searching for missing custom data properties

* Add has-cd query
2023-09-01 14:13:31 +10:00
Nil Admirari
9d3f01043b
Support AVIF (#2630) 2023-08-31 08:44:10 +10:00
Damien Elmes
e86cebd45e Fix importing link 2023-08-31 07:52:21 +10:00
Damien Elmes
408b48834b Fix clippy issues in Rust 1.72 2023-08-25 07:56:38 +10:00
Damien Elmes
cdcd9bcce0 New collections now start with the v3 scheduler 2023-08-19 13:31:01 +10:00
Damien Elmes
d2022d1a6d Avoid allocating in extract_latex() if possible; make public 2023-08-19 08:05:39 +10:00
Damien Elmes
b73cb15888 Take another approach to dealing with conflicting flattened keys
The approach in #2542 unfortunately introduced a regression, as whilst
it ensured that duplicate keys are removed when downgrading, it no longer
prevented the duplicates from being removed when converting to a legacy
Schema11 object. This resulted in things like backend.get_notetype_legacy()
returning duplicate keys, and could break syncing:

https://forums.ankiweb.net/t/windows-desktop-sync-error/33128

As syncing and schema11 object usage is quite common compared to downgrading,
the extra Value deserialization seemed a bit expensive, so I've switched
back to explicitly removing the problem keys. To ensure we don't forget to
add new keys in the future, I've added some new tests that should alert us
whenever a newly-added key is missing from the reserved list.
2023-08-15 11:25:53 +10:00
Damien Elmes
c112236dd9 Support include_filtered=false, skip_default=true case 2023-08-08 15:34:43 +10:00