mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
increase the rated search cap to 365, and allow searches for ease 0
An add-on appears to use ease 0 when rescheduling cards, and it may make sense for Anki to do the same in the future as well.
This commit is contained in:
parent
51a379de23
commit
9696e959be
2 changed files with 5 additions and 5 deletions
|
@ -314,14 +314,14 @@ fn parse_flag(s: &str) -> ParseResult<SearchNode<'static>> {
|
|||
}
|
||||
|
||||
/// eg rated:3 or rated:10:2
|
||||
/// second arg must be between 1-4
|
||||
/// second arg must be between 0-4
|
||||
fn parse_rated(val: &str) -> ParseResult<SearchNode<'static>> {
|
||||
let mut it = val.splitn(2, ':');
|
||||
let days = it.next().unwrap().parse()?;
|
||||
let ease = match it.next() {
|
||||
Some(v) => {
|
||||
let n: u8 = v.parse()?;
|
||||
if n < 5 && n > 0 {
|
||||
if n < 5 {
|
||||
Some(n)
|
||||
} else {
|
||||
return Err(ParseError {});
|
||||
|
|
|
@ -131,7 +131,7 @@ impl SqlWriter<'_, '_> {
|
|||
|
||||
fn write_rated(&mut self, days: u32, ease: Option<u8>) -> Result<()> {
|
||||
let today_cutoff = self.req.storage.timing_today()?.next_day_at;
|
||||
let days = days.min(31) as i64;
|
||||
let days = days.min(365) as i64;
|
||||
let target_cutoff_ms = (today_cutoff - 86_400 * days) * 1_000;
|
||||
write!(
|
||||
self.sql,
|
||||
|
@ -543,10 +543,10 @@ mod test {
|
|||
)
|
||||
);
|
||||
assert_eq!(
|
||||
s(ctx, "rated:40:1").0,
|
||||
s(ctx, "rated:400:1").0,
|
||||
format!(
|
||||
"(c.id in (select cid from revlog where id>{} and ease=1))",
|
||||
(timing.next_day_at - (86_400 * 31)) * 1_000
|
||||
(timing.next_day_at - (86_400 * 365)) * 1_000
|
||||
)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue