Add forgot, due and added filters on backend

This commit is contained in:
RumovZ 2021-01-28 11:11:32 +01:00
parent 687e0b070b
commit b15bb4289e
2 changed files with 16 additions and 1 deletions

View file

@ -791,6 +791,12 @@ 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;
}
}

View file

@ -36,7 +36,7 @@ use crate::{
sched::timespan::{answer_button_time, time_span},
search::{
concatenate_searches, negate_search, normalize_search, replace_search_term, write_nodes,
BoolSeparator, EaseKind, Node, SearchNode, SortMode, StateKind, TemplateKind,
BoolSeparator, EaseKind, Node, PropertyKind, SearchNode, SortMode, StateKind, TemplateKind,
},
stats::studied_today,
sync::{
@ -331,6 +331,15 @@ 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 {
days: u,
ease: EaseKind::AnswerButton(1),
}),
Filter::AddedIn(u) => Node::Search(SearchNode::AddedInDays(u)),
Filter::DueIn(i) => Node::Search(SearchNode::Property {
operator: "<=".to_string(),
kind: PropertyKind::Due(i),
}),
}
}
}