RumovZ
3864857b07
Outsource incrementing into Incrementor
2022-04-30 18:33:25 +02:00
RumovZ
58235d3709
Move update_interval into IncrementableProgress
2022-04-30 09:14:56 +02:00
RumovZ
e6225210fc
Take count_map for IncrementableProgress::get_inner
2022-04-29 20:56:23 +02:00
RumovZ
400fc3b0f6
Fix type complexity lint
2022-04-29 20:40:38 +02:00
RumovZ
aba7b0830c
Generalise IncrementableProgress
...
And use it in entire import_export code instead.
2022-04-29 20:38:01 +02:00
RumovZ
06cc44a3ed
Make downgrading apkgs depend on meta version
2022-04-29 13:44:36 +02:00
RumovZ
c65d1818ed
ImportProgress::Collection → ImportProgress::File
2022-04-29 10:39:56 +02:00
RumovZ
76f4bf26ea
Avoid registering changes if hashes are not needed
2022-04-29 10:35:19 +02:00
RumovZ
146fd2a6b6
Compare checksums when importing colpkgs
2022-04-28 22:32:12 +02:00
RumovZ
930f4212b2
Use IncrementalProgress in whole import_export code
2022-04-28 19:01:34 +02:00
Damien Elmes
cf9d490576
Fix a crash when truncating note text
...
String::truncate() is a bit of a footgun, and I've hit this before
too :-)
2022-04-28 20:51:36 +10:00
RumovZ
20322fb753
Add search_cards_of_notes_into_table.sql
2022-04-27 21:56:27 +02:00
RumovZ
f03df4ac3a
target_already_exists→card_ordinal_already_exists
2022-04-27 21:52:40 +02:00
RumovZ
274afc7b3f
export_collection_extracting_media() → ...
...
export_into_collection_file()
2022-04-27 21:50:22 +02:00
RumovZ
60c6869a05
target[_id]s → existing_card[_id]s
2022-04-27 21:48:19 +02:00
RumovZ
07ff01f96d
Fix sorting of imported decks
...
Also adjust the test, so it fails without the patch. It was only passing
before, because the parent deck happened to come before the
inconsistently capitalised child alphabetically. But we want all parent
decks to be imported before their child decks, so their children can
adopt their capitalisation.
2022-04-27 21:41:50 +02:00
RumovZ
4938a30405
Rework apkg note import tests
...
- Use macros for more helpful errors.
- Split monolith into unit tests.
- Fix some unknown error with the previous test along the way.
(Was failing after 969484de4388d225c9f17d94534b3ba0094c3568.)
2022-04-27 21:25:02 +02:00
RumovZ
b0d97454a8
Truncate logged fields
2022-04-27 18:42:34 +02:00
RumovZ
382d7417a8
Alias [u8; 20] with Sha1Hash
2022-04-27 18:36:11 +02:00
RumovZ
f2988f8054
take_fields() → into_fields()
2022-04-27 18:34:29 +02:00
RumovZ
969484de43
Log conflicting note in remapped nt case
2022-04-27 18:25:12 +02:00
Damien Elmes
a4dfad565d
Fix a corner-case where due dates were shifted by a day
...
This issue existed in the old Python code as well. We need to include
the user's UTC offset in the exported file, or days_elapsed falls back
on the v1 cutoff calculation, which may be a day earlier or later than
the v2 calculation.
2022-04-27 16:27:13 +10:00
Damien Elmes
308c663233
Reset filtered decks at import time
...
Before this change, filtered decks exported with scheduling remained
filtered on import, and maybe_remove_from_filtered_deck() moved cards
into them as their home deck, leading to errors during review.
We may still want to provide a way to preserve filtered decks on import,
but to do that we'll need to ensure we don't rewrite the home decks of
cards, and we'll need to ensure the home decks are included as part of
the import (or give an error if they're not).
https://github.com/ankitects/anki/pull/1743/files#r839346423
2022-04-27 14:48:47 +10:00
Damien Elmes
23eda19677
Show progress of note imports
...
Note import is the slowest part, so showing progress here makes the UI
feel more responsive.
2022-04-27 13:49:04 +10:00
Damien Elmes
d645824098
Update progress after prepare_media() finishes
...
Otherwise the bulk of the import ends up being shown as "Checked: 0"
in the progress window.
2022-04-27 13:20:28 +10:00
Damien Elmes
c4ebbd719c
Avoid an extra allocation when extracting media checksums
2022-04-27 11:39:51 +10:00
Damien Elmes
055b404165
Add legacy arg to ExportAnkiPackage
...
Currently not exposed on the frontend
2022-04-26 21:30:47 +10:00
Damien Elmes
ede9698aea
Handle zstd-compressed apkg
2022-04-26 21:30:28 +10:00
RumovZ
766396809d
Open transaction in insert_data()
...
Was slowing down exporting by several orders of magnitude.
2022-04-25 09:50:37 +02:00
RumovZ
266362b917
Return number of notes imported from apkg
2022-04-25 08:29:01 +02:00
RumovZ
e4d36e71f3
Make apkg exporting on backend abortable
2022-04-25 08:28:26 +02:00
RumovZ
e6dbe5b7f8
Fix all_checksums() for media import
...
Entries of deleted files are nulled, not removed.
2022-04-25 08:24:11 +02:00
RumovZ
8c1a4d0cdd
Update progress when checking incoming media too
2022-04-22 21:22:56 +02:00
RumovZ
6eb8aa0987
Add note ids to log and strip HTML
2022-04-22 19:01:17 +02:00
RumovZ
592e7e240c
Fix archived collection name on apkg import
2022-04-21 09:03:10 +02:00
RumovZ
63ad6624a6
Return note log when importing apkg
2022-04-20 20:48:22 +02:00
RumovZ
6b85b5900f
Expose apkg export/import on backend
2022-04-20 16:01:34 +02:00
RumovZ
16f8c980a6
Fix progress_fn type
2022-04-17 09:35:56 +02:00
RumovZ
e65b79ba63
Use fat pointer to avoid propogating generics
2022-04-16 22:14:01 +02:00
RumovZ
ed24fd13db
Expand roundtrip apkg test
2022-04-16 19:19:44 +02:00
RumovZ
bb27eb3f08
Let import_apkg() take a progress func
2022-04-16 17:12:16 +02:00
RumovZ
a78d101c53
Test note importing
2022-04-16 12:31:42 +02:00
RumovZ
1e22432233
Fix deck importing edge cases
...
Test those edge cases, and add some global test helpers.
2022-04-15 19:07:52 +02:00
RumovZ
42f55fc30a
Unconditionally import static media
2022-04-15 12:13:37 +02:00
RumovZ
7af0b08375
Fix parent deck gathering
2022-04-15 11:25:48 +02:00
RumovZ
f0cc027db6
Merge remote-tracking branch 'upstream/HEAD' into apkg
2022-04-15 08:57:07 +02:00
RumovZ
8ccadd96e6
Store last position when scheduling as review ( #1800 )
2022-04-14 18:53:58 +10:00
RumovZ
4c79a1d969
Merge branch 'main' into apkg
2022-04-13 09:50:27 +02:00
RumovZ
71e6292f8d
Maybe upgrade scheduler of apkg
2022-04-11 09:10:08 +02:00
RumovZ
251bfc4920
Factor out media importing
2022-04-11 08:44:18 +02:00