Reintroduce false removed limits
This commit is contained in:
parent
e7660113ce
commit
947260e4aa
@ -406,7 +406,7 @@ fn parse_prop(s: &str) -> ParseResult<SearchNode> {
|
|||||||
let mut it = num.splitn(2, ':');
|
let mut it = num.splitn(2, ':');
|
||||||
|
|
||||||
let days: i32 = if let Ok(i) = it.next().unwrap().parse::<i32>() {
|
let days: i32 = if let Ok(i) = it.next().unwrap().parse::<i32>() {
|
||||||
i
|
i.min(0)
|
||||||
} else {
|
} else {
|
||||||
return Err(parse_failure(
|
return Err(parse_failure(
|
||||||
s,
|
s,
|
||||||
@ -438,7 +438,7 @@ fn parse_prop(s: &str) -> ParseResult<SearchNode> {
|
|||||||
PropertyKind::Rated(days, ease)
|
PropertyKind::Rated(days, ease)
|
||||||
} else if prop == "resched" {
|
} else if prop == "resched" {
|
||||||
if let Ok(days) = num.parse::<i32>() {
|
if let Ok(days) = num.parse::<i32>() {
|
||||||
PropertyKind::Rated(days, EaseKind::ManualReschedule)
|
PropertyKind::Rated(days.min(0), EaseKind::ManualReschedule)
|
||||||
} else {
|
} else {
|
||||||
return Err(parse_failure(
|
return Err(parse_failure(
|
||||||
s,
|
s,
|
||||||
@ -489,6 +489,7 @@ fn parse_edited(s: &str) -> ParseResult<SearchNode> {
|
|||||||
fn parse_rated(s: &str) -> ParseResult<SearchNode> {
|
fn parse_rated(s: &str) -> ParseResult<SearchNode> {
|
||||||
let mut it = s.splitn(2, ':');
|
let mut it = s.splitn(2, ':');
|
||||||
if let Ok(days) = it.next().unwrap().parse::<u32>() {
|
if let Ok(days) = it.next().unwrap().parse::<u32>() {
|
||||||
|
let days = days.max(1);
|
||||||
let ease = if let Some(tail) = it.next() {
|
let ease = if let Some(tail) = it.next() {
|
||||||
if let Ok(u) = tail.parse::<u8>() {
|
if let Ok(u) = tail.parse::<u8>() {
|
||||||
if u > 0 && u < 5 {
|
if u > 0 && u < 5 {
|
||||||
|
@ -734,7 +734,7 @@ mod test {
|
|||||||
s(ctx, "rated:400:1").0,
|
s(ctx, "rated:400:1").0,
|
||||||
format!(
|
format!(
|
||||||
"(c.id in (select cid from revlog where id >= {} and ease = 1))",
|
"(c.id in (select cid from revlog where id >= {} and ease = 1))",
|
||||||
(timing.next_day_at - (86_400 * 365)) * 1_000
|
(timing.next_day_at - (86_400 * 400)) * 1_000
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assert_eq!(s(ctx, "rated:0").0, s(ctx, "rated:1").0);
|
assert_eq!(s(ctx, "rated:0").0, s(ctx, "rated:1").0);
|
||||||
@ -744,7 +744,7 @@ mod test {
|
|||||||
s(ctx, "resched:400").0,
|
s(ctx, "resched:400").0,
|
||||||
format!(
|
format!(
|
||||||
"(c.id in (select cid from revlog where id >= {} and ease = 0))",
|
"(c.id in (select cid from revlog where id >= {} and ease = 0))",
|
||||||
(timing.next_day_at - (86_400 * 365)) * 1_000
|
(timing.next_day_at - (86_400 * 400)) * 1_000
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -759,6 +759,7 @@ mod test {
|
|||||||
cutoff = timing.next_day_at
|
cutoff = timing.next_day_at
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
assert_eq!(s(ctx, "prop:rated>-5:3").0, s(ctx, "rated:5:3").0);
|
||||||
|
|
||||||
// note types by name
|
// note types by name
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
Loading…
Reference in New Issue
Block a user