From b15bb4289e5fe606d39d020f52f62e5987d8f273 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Thu, 28 Jan 2021 11:11:32 +0100 Subject: [PATCH] Add forgot, due and added filters on backend --- rslib/backend.proto | 6 ++++++ rslib/src/backend/mod.rs | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rslib/backend.proto b/rslib/backend.proto index 93c1a3990..62648e10f 100644 --- a/rslib/backend.proto +++ b/rslib/backend.proto @@ -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; } } diff --git a/rslib/src/backend/mod.rs b/rslib/src/backend/mod.rs index 71e1595de..9cf765f8a 100644 --- a/rslib/src/backend/mod.rs +++ b/rslib/src/backend/mod.rs @@ -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 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), + }), } } }