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 days: i32 = if let Ok(i) = it.next().unwrap().parse::<i32>() {
|
||||
i
|
||||
i.min(0)
|
||||
} else {
|
||||
return Err(parse_failure(
|
||||
s,
|
||||
@ -438,7 +438,7 @@ fn parse_prop(s: &str) -> ParseResult<SearchNode> {
|
||||
PropertyKind::Rated(days, ease)
|
||||
} else if prop == "resched" {
|
||||
if let Ok(days) = num.parse::<i32>() {
|
||||
PropertyKind::Rated(days, EaseKind::ManualReschedule)
|
||||
PropertyKind::Rated(days.min(0), EaseKind::ManualReschedule)
|
||||
} else {
|
||||
return Err(parse_failure(
|
||||
s,
|
||||
@ -489,6 +489,7 @@ fn parse_edited(s: &str) -> ParseResult<SearchNode> {
|
||||
fn parse_rated(s: &str) -> ParseResult<SearchNode> {
|
||||
let mut it = s.splitn(2, ':');
|
||||
if let Ok(days) = it.next().unwrap().parse::<u32>() {
|
||||
let days = days.max(1);
|
||||
let ease = if let Some(tail) = it.next() {
|
||||
if let Ok(u) = tail.parse::<u8>() {
|
||||
if u > 0 && u < 5 {
|
||||
|
@ -734,7 +734,7 @@ mod test {
|
||||
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 * 365)) * 1_000
|
||||
(timing.next_day_at - (86_400 * 400)) * 1_000
|
||||
)
|
||||
);
|
||||
assert_eq!(s(ctx, "rated:0").0, s(ctx, "rated:1").0);
|
||||
@ -744,7 +744,7 @@ mod test {
|
||||
s(ctx, "resched:400").0,
|
||||
format!(
|
||||
"(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
|
||||
)
|
||||
);
|
||||
assert_eq!(s(ctx, "prop:rated>-5:3").0, s(ctx, "rated:5:3").0);
|
||||
|
||||
// note types by name
|
||||
assert_eq!(
|
||||
|
Loading…
Reference in New Issue
Block a user