Commit graph

844 commits

Author SHA1 Message Date
Damien Elmes
ff8c8a3bca simplify unused tags and DB check
- backend routines should contain minimal logic, and should call
into a routine on the collection
- instead of copying the giant-string approach the Python code was taking,
we use a HashSet to keep track of seen tags as we loop through the
notes, which should be more efficient
2021-01-16 20:38:16 +10:00
Damien Elmes
7f4850659d no need for separate all_tags_sorted()
tag is the primary key, so sqlite will give it back to us in
sorted order already.
2021-01-16 19:46:58 +10:00
Damien Elmes
f41eb90c21 custom ord/partialeq is not required; fix clippy lint 2021-01-16 19:44:37 +10:00
Damien Elmes
1288191743 handle missing parent names with varying case
Also convert to \x1f before sorting, so that numbers (with have a lower
ascii order than '::') don't mess up the sort.
2021-01-16 19:42:25 +10:00
Damien Elmes
82f9143171 add a (currently failing) test for duplicate parent names 2021-01-16 19:04:25 +10:00
abdo
112aa44c90 Merge branch 'master' of https://github.com/ankitects/anki into tagtree 2021-01-15 01:12:01 +03:00
abdo
b3b6351f74 Fix unicode tag sorting 2021-01-14 07:04:55 +03:00
abdo
dd3f0d44fe Remove Default impl of Tag 2021-01-14 07:04:55 +03:00
abdo
4911945b9b Refactor code for clearing unused tags and saving collapse state 2021-01-14 07:04:14 +03:00
RumovZ
cbb9bb96a7 Add pb message for dupe filter 2021-01-14 10:42:37 +10:00
RumovZ
6c66da5578 Expect backslashes to be escaped in dupe: text 2021-01-14 10:42:37 +10:00
RumovZ
530cfebe19 Fix writing dupe nodes
Rename comments and dupe functions on the backend accordingly to avoid
further confusion.
2021-01-14 10:42:37 +10:00
Damien Elmes
9f3959ccad Merge pull request #918 from hgiesel/ratedflags
Introduce `resched:n` instead of `rated:n:0`
2021-01-14 10:19:10 +10:00
Henrik Giesel
42b10e5a12 Change "between 1 and 4" to "> 0" 2021-01-13 11:44:54 +01:00
Henrik Giesel
28c53a410a Rename EaseKind values 2021-01-13 11:41:48 +01:00
Damien Elmes
6cc58451b1 add local sync server frontend 2021-01-13 11:42:00 +10:00
abdo
c423e8d7bb Merge branch 'master' of https://github.com/ankitects/anki into tagtree 2021-01-12 23:31:58 +03:00
abdo
e3c873fb32 Keep tags in human form and update the tags table structure
See https://github.com/ankitects/anki/pull/900#issuecomment-758284016

- Leave tag names alone and add the collapsed and config columns to the tags table.
- Update The DB check code to preserve the collapse state of used tags.
- Add a simple test for clearing tags and their children
2021-01-12 23:12:35 +03:00
Damien Elmes
48892e588b tidy up UTC offset handling/timing calculations
- use the TimestampSecs newtype instead of raw i64s
- use FixedOffset instead of a minutes_west offset
- check localOffset each time the timing is calculated, and set it
if it's stale - even for v1.
- check for and fix missing rollover when calculating timing
- stop explicitly passing localOffset in the sync/start call
2021-01-12 21:32:56 +10:00
Damien Elmes
1f7faa8bc2 add .clang-format so VS Code preserves formatting style on .proto save 2021-01-12 18:47:08 +10:00
Damien Elmes
f1fd6df0a6 move sync JSON into separate file; add enum wrapper 2021-01-12 18:47:08 +10:00
Damien Elmes
e89d02433d allow normal sync tests to run offline 2021-01-12 18:47:08 +10:00
Damien Elmes
1cef09b2fa use '<=' when merging UnchunkableChanges
Prevents current tests from failing when testing locally, due the current
second not changing between syncs.
2021-01-12 18:47:08 +10:00
Henrik Giesel
1e74e79a1f Coerce resched:days as well 2021-01-11 17:25:42 +01:00
Henrik Giesel
00acdd3bf7 Satisfy rslib unit tests 2021-01-11 17:18:40 +01:00
Henrik Giesel
fc52046808 Remove EaseKind impl in favor of transforming to sql in function 2021-01-11 17:10:17 +01:00
Henrik Giesel
fe15df1c4f Introduce "resched:n" instead of 0 and a flag for "rated" 2021-01-11 16:40:30 +01:00
Henrik Giesel
08e6f5982e Modify default behavior of rated searches to exclude manual 2021-01-11 16:40:30 +01:00
Damien Elmes
43e05aff6c update Rust deps; add async_trait 2021-01-11 19:19:45 +10:00
Damien Elmes
4b98ce0145 Merge pull request #917 from hgiesel/querynozero3
Coerce added/edited:0 to 1, Constrain rated:n to 1-365
2021-01-11 16:24:12 +10:00
Henrik Giesel
5b1bf8a10e Fix formatting 2021-01-10 16:38:20 +01:00
Henrik Giesel
40ab80f70e Add a few rslib unit tests 2021-01-10 16:29:10 +01:00
Henrik Giesel
027677ac6d Remove coercion in write_rated 2021-01-10 16:23:53 +01:00
Henrik Giesel
d7513fd33d Coerce added/edited:0 to 1, constrain rated:n to 1 <= 365 2021-01-10 16:16:17 +01:00
Damien Elmes
eda1fb49fd favour readability over brevity in filter conversion 2021-01-10 09:19:33 +10:00
Damien Elmes
cbd4439f30 Merge pull request #913 from RumovZ/fix-write-template
Fix ordinal case in write_template
2021-01-10 08:58:00 +10:00
Damien Elmes
6fecea257b Merge pull request #911 from RumovZ/backend-filters
Backend filters
2021-01-10 08:56:57 +10:00
Damien Elmes
9d95e11505 fix protobuf formatting adding carriage returns on Windows 2021-01-10 08:48:20 +10:00
RumovZ
8798d84cfd Format backend.proto 2021-01-09 20:09:47 +01:00
RumovZ
0bf7ad0951 Merge branch 'master' into backend-filters
Adapt new formatting.
2021-01-09 19:03:43 +01:00
RumovZ
4911757177 Fix ordinal case in write_template
Internal card ordinals start at 0, so add 1 again when writing a
template search string from a parsed ordinal.
2021-01-09 17:30:12 +01:00
abdo
12c09d7f80 Remove unused backend methods & formatting 2021-01-09 17:48:34 +03:00
abdo
26d595b428 Fix tag collapse state not getting updated 2021-01-09 17:46:52 +03:00
abdo
68dfbed55f sql formatting 2021-01-09 17:38:16 +03:00
abdo
a17d309ed3 Move tag collapse method to the backend 2021-01-09 17:10:16 +03:00
abdo
931fa31178 Move sql code for upgrading to schema 17 to a separate file 2021-01-09 17:10:16 +03:00
abdo
6c9a94851c fill_missing_tags's input should be sorted
I assumed that fill_missing_tags will work correctly with un unsorted
tag list previously so I replaced the all_tags_sorted call, but take the following the list for example:

["foo::bar", "foo"]

This will cause "foo" to be counted like a missing tag, since it's
encountered the first time when looking at "foo::bar"", and its config
and other associated data will be lost.
2021-01-09 17:10:16 +03:00
abdo
a18227acc4 Do not check for missing tag parents at registration time 2021-01-09 17:10:16 +03:00
abdo
a30a2638ce Hierarchical tags 2021-01-09 17:10:13 +03:00
RumovZ
455b693623 Provide filter searches through backend 2021-01-09 10:50:08 +01:00