Rename filters added_in etc. to added_in_days

This commit is contained in:
RumovZ 2021-01-29 09:38:13 +01:00
parent f04228990d
commit 1fb6024454
4 changed files with 18 additions and 21 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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;
}

View File

@ -341,12 +341,12 @@ impl From<pb::FilterToSearchIn> 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),
}),