From 1fb60244549922d7cd83e8740daef5a22f771a08 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Fri, 29 Jan 2021 09:38:13 +0100 Subject: [PATCH] Rename filters added_in etc. to added_in_days --- pylib/anki/collection.py | 18 +++++++++--------- qt/aqt/customstudy.py | 6 +++--- rslib/backend.proto | 9 +++------ rslib/src/backend/mod.rs | 6 +++--- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 4f45e1145..076c40186 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -501,9 +501,9 @@ class Collection: note: Optional[str] = None, template: Optional[int] = None, dupe: Optional[Tuple[int, str]] = None, - forgot_in: Optional[int] = None, - added_in: Optional[int] = None, - due_in: Optional[int] = None, + forgot_in_days: Optional[int] = None, + added_in_days: Optional[int] = None, + due_in_days: Optional[int] = None, nids: Optional[List[int]] = None, field_name: Optional[str] = None, ) -> str: @@ -525,12 +525,12 @@ class Collection: if dupe: dupe_in = DupeIn(mid=BackendNoteTypeID(ntid=dupe[0]), text=dupe[1]) append_filter(FilterToSearchIn(dupe=dupe_in)) - if forgot_in: - append_filter(FilterToSearchIn(forgot_in=forgot_in)) - if added_in: - append_filter(FilterToSearchIn(added_in=added_in)) - if due_in: - append_filter(FilterToSearchIn(due_in=due_in)) + if forgot_in_days: + append_filter(FilterToSearchIn(forgot_in_days=forgot_in_days)) + if added_in_days: + append_filter(FilterToSearchIn(added_in_days=added_in_days)) + if due_in_days: + append_filter(FilterToSearchIn(due_in_days=due_in_days)) if nids: append_filter(FilterToSearchIn(nids=NoteIDs(nids=nids))) if field_name: diff --git a/qt/aqt/customstudy.py b/qt/aqt/customstudy.py index 8113438fd..ca5c5c3c6 100644 --- a/qt/aqt/customstudy.py +++ b/qt/aqt/customstudy.py @@ -160,15 +160,15 @@ class CustomStudy(QDialog): dyn = self.mw.col.decks.get(did) # and then set various options if i == RADIO_FORGOT: - search = self.mw.col.search_string(forgot_in=spin) + search = self.mw.col.search_string(forgot_in_days=spin) dyn["terms"][0] = [search, DYN_MAX_SIZE, DYN_RANDOM] dyn["resched"] = False elif i == RADIO_AHEAD: - search = self.mw.col.search_string(due_in=spin) + search = self.mw.col.search_string(due_in_days=spin) dyn["terms"][0] = [search, DYN_MAX_SIZE, DYN_DUE] dyn["resched"] = True elif i == RADIO_PREVIEW: - search = self.mw.col.search_string(name=NamedFilter.NEW, added_in=spin) + search = self.mw.col.search_string(name=NamedFilter.NEW, added_in_days=spin) dyn["terms"][0] = [search, DYN_MAX_SIZE, DYN_OLDEST] dyn["resched"] = False elif i == RADIO_CRAM: diff --git a/rslib/backend.proto b/rslib/backend.proto index e984b1f97..fed42f957 100644 --- a/rslib/backend.proto +++ b/rslib/backend.proto @@ -795,12 +795,9 @@ message FilterToSearchIn { string note = 4; uint32 template = 5; DupeIn dupe = 6; - // rated Again in the last x days - uint32 forgot_in = 7; - // added in the last x days - uint32 added_in = 8; - // will be due in the next x days - int32 due_in = 9; + uint32 forgot_in_days = 7; + uint32 added_in_days = 8; + int32 due_in_days = 9; NoteIDs nids = 10; string field_name = 11; } diff --git a/rslib/src/backend/mod.rs b/rslib/src/backend/mod.rs index 48d9065dd..5a6f6aba2 100644 --- a/rslib/src/backend/mod.rs +++ b/rslib/src/backend/mod.rs @@ -341,12 +341,12 @@ impl From for Node<'_> { note_type_id: dupe.mid.unwrap_or(pb::NoteTypeId { ntid: 0 }).into(), text: dupe.text.into(), }), - Filter::ForgotIn(u) => Node::Search(SearchNode::Rated { + Filter::ForgotInDays(u) => Node::Search(SearchNode::Rated { days: u, ease: EaseKind::AnswerButton(1), }), - Filter::AddedIn(u) => Node::Search(SearchNode::AddedInDays(u)), - Filter::DueIn(i) => Node::Search(SearchNode::Property { + Filter::AddedInDays(u) => Node::Search(SearchNode::AddedInDays(u)), + Filter::DueInDays(i) => Node::Search(SearchNode::Property { operator: "<=".to_string(), kind: PropertyKind::Due(i), }),