mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
combine forgot_in_days and studied_today into a more general 'rated'
This commit is contained in:
parent
2ca4f31fc8
commit
22b80c2dd5
4 changed files with 49 additions and 13 deletions
|
@ -993,8 +993,18 @@ QTableView {{ gridline-color: {grid} }}
|
||||||
self._simpleFilters(
|
self._simpleFilters(
|
||||||
(
|
(
|
||||||
(tr(TR.BROWSING_ADDED_TODAY), SearchTerm(added_in_days=1)),
|
(tr(TR.BROWSING_ADDED_TODAY), SearchTerm(added_in_days=1)),
|
||||||
(tr(TR.BROWSING_STUDIED_TODAY), SearchTerm(studied_today=True)),
|
(
|
||||||
(tr(TR.BROWSING_AGAIN_TODAY), SearchTerm(forgot_in_days=1)),
|
tr(TR.BROWSING_STUDIED_TODAY),
|
||||||
|
SearchTerm(rated=SearchTerm.Rated(days=1)),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
tr(TR.BROWSING_AGAIN_TODAY),
|
||||||
|
SearchTerm(
|
||||||
|
rated=SearchTerm.Rated(
|
||||||
|
days=1, rating=SearchTerm.Rated.Rating.ANSWER_BUTTON_1
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -160,7 +160,13 @@ class CustomStudy(QDialog):
|
||||||
dyn = self.mw.col.decks.get(did)
|
dyn = self.mw.col.decks.get(did)
|
||||||
# and then set various options
|
# and then set various options
|
||||||
if i == RADIO_FORGOT:
|
if i == RADIO_FORGOT:
|
||||||
search = self.mw.col.build_search_string(SearchTerm(forgot_in_days=spin))
|
search = self.mw.col.build_search_string(
|
||||||
|
SearchTerm(
|
||||||
|
rated=SearchTerm.Rated(
|
||||||
|
days=spin, rating=SearchTerm.Rated.Rating.ANSWER_BUTTON_1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
dyn["terms"][0] = [search, DYN_MAX_SIZE, DYN_RANDOM]
|
dyn["terms"][0] = [search, DYN_MAX_SIZE, DYN_RANDOM]
|
||||||
dyn["resched"] = False
|
dyn["resched"] = False
|
||||||
elif i == RADIO_AHEAD:
|
elif i == RADIO_AHEAD:
|
||||||
|
|
|
@ -777,6 +777,18 @@ message FilterToSearchIn {
|
||||||
GREEN = 4;
|
GREEN = 4;
|
||||||
BLUE = 5;
|
BLUE = 5;
|
||||||
}
|
}
|
||||||
|
message Rated {
|
||||||
|
enum Rating {
|
||||||
|
ANY_ANSWER_BUTTON = 0;
|
||||||
|
ANSWER_BUTTON_1 = 1;
|
||||||
|
ANSWER_BUTTON_2 = 2;
|
||||||
|
ANSWER_BUTTON_3 = 3;
|
||||||
|
ANSWER_BUTTON_4 = 4;
|
||||||
|
MANUAL_RESCHEDULE = 5;
|
||||||
|
}
|
||||||
|
uint32 days = 1;
|
||||||
|
Rating rating = 2;
|
||||||
|
}
|
||||||
oneof filter {
|
oneof filter {
|
||||||
string tag = 1;
|
string tag = 1;
|
||||||
string deck = 2;
|
string deck = 2;
|
||||||
|
@ -785,19 +797,18 @@ message FilterToSearchIn {
|
||||||
NoteIDs nids = 5;
|
NoteIDs nids = 5;
|
||||||
DupeIn dupe = 6;
|
DupeIn dupe = 6;
|
||||||
string field_name = 7;
|
string field_name = 7;
|
||||||
uint32 forgot_in_days = 8;
|
Rated rated = 8;
|
||||||
uint32 added_in_days = 9;
|
uint32 added_in_days = 9;
|
||||||
int32 due_in_days = 10;
|
int32 due_in_days = 10;
|
||||||
bool whole_collection = 11;
|
bool whole_collection = 11;
|
||||||
bool current_deck = 12;
|
bool current_deck = 12;
|
||||||
bool studied_today = 13;
|
Flag flag = 13;
|
||||||
bool new = 14;
|
bool new = 14;
|
||||||
bool learn = 15;
|
bool learn = 15;
|
||||||
bool review = 16;
|
bool review = 16;
|
||||||
bool due = 17;
|
bool due = 17;
|
||||||
bool suspended = 18;
|
bool suspended = 18;
|
||||||
bool buried = 19;
|
bool buried = 19;
|
||||||
Flag flag = 20;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -317,9 +317,9 @@ impl From<pb::FilterToSearchIn> for Node<'_> {
|
||||||
text: "*".to_string().into(),
|
text: "*".to_string().into(),
|
||||||
is_re: false,
|
is_re: false,
|
||||||
}),
|
}),
|
||||||
Filter::ForgotInDays(u) => Node::Search(SearchNode::Rated {
|
Filter::Rated(rated) => Node::Search(SearchNode::Rated {
|
||||||
days: u,
|
days: rated.days,
|
||||||
ease: EaseKind::AnswerButton(1),
|
ease: rated.rating().into(),
|
||||||
}),
|
}),
|
||||||
Filter::AddedInDays(u) => Node::Search(SearchNode::AddedInDays(u)),
|
Filter::AddedInDays(u) => Node::Search(SearchNode::AddedInDays(u)),
|
||||||
Filter::DueInDays(i) => Node::Search(SearchNode::Property {
|
Filter::DueInDays(i) => Node::Search(SearchNode::Property {
|
||||||
|
@ -328,10 +328,6 @@ impl From<pb::FilterToSearchIn> for Node<'_> {
|
||||||
}),
|
}),
|
||||||
Filter::WholeCollection(_) => Node::Search(SearchNode::WholeCollection),
|
Filter::WholeCollection(_) => Node::Search(SearchNode::WholeCollection),
|
||||||
Filter::CurrentDeck(_) => Node::Search(SearchNode::Deck("current".into())),
|
Filter::CurrentDeck(_) => Node::Search(SearchNode::Deck("current".into())),
|
||||||
Filter::StudiedToday(_) => Node::Search(SearchNode::Rated {
|
|
||||||
days: 1,
|
|
||||||
ease: EaseKind::AnyAnswerButton,
|
|
||||||
}),
|
|
||||||
Filter::New(_) => Node::Search(SearchNode::State(StateKind::New)),
|
Filter::New(_) => Node::Search(SearchNode::State(StateKind::New)),
|
||||||
Filter::Learn(_) => Node::Search(SearchNode::State(StateKind::Learning)),
|
Filter::Learn(_) => Node::Search(SearchNode::State(StateKind::Learning)),
|
||||||
Filter::Review(_) => Node::Search(SearchNode::State(StateKind::Review)),
|
Filter::Review(_) => Node::Search(SearchNode::State(StateKind::Review)),
|
||||||
|
@ -359,6 +355,19 @@ impl From<BoolSeparatorProto> for BoolSeparator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<pb::filter_to_search_in::rated::Rating> for EaseKind {
|
||||||
|
fn from(r: pb::filter_to_search_in::rated::Rating) -> Self {
|
||||||
|
match r {
|
||||||
|
pb::filter_to_search_in::rated::Rating::AnswerButton1 => EaseKind::AnswerButton(1),
|
||||||
|
pb::filter_to_search_in::rated::Rating::AnswerButton2 => EaseKind::AnswerButton(2),
|
||||||
|
pb::filter_to_search_in::rated::Rating::AnswerButton3 => EaseKind::AnswerButton(3),
|
||||||
|
pb::filter_to_search_in::rated::Rating::AnswerButton4 => EaseKind::AnswerButton(4),
|
||||||
|
pb::filter_to_search_in::rated::Rating::AnyAnswerButton => EaseKind::AnyAnswerButton,
|
||||||
|
pb::filter_to_search_in::rated::Rating::ManualReschedule => EaseKind::ManualReschedule,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl BackendService for Backend {
|
impl BackendService for Backend {
|
||||||
fn latest_progress(&self, _input: Empty) -> BackendResult<pb::Progress> {
|
fn latest_progress(&self, _input: Empty) -> BackendResult<pb::Progress> {
|
||||||
let progress = self.progress_state.lock().unwrap().last_progress;
|
let progress = self.progress_state.lock().unwrap().last_progress;
|
||||||
|
|
Loading…
Reference in a new issue