mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Fix negated introduced:x
search (#2306)
1. Add outer brackets. 2. Coalesce aggregate, because `null and true` is `null` in SQL land, so cards that were not introduced, but manually rescheduled in the period of interest, would not show up in a negated search.
This commit is contained in:
parent
91d563278f
commit
6df7be90c5
1 changed files with 4 additions and 4 deletions
|
@ -578,11 +578,11 @@ impl SqlWriter<'_> {
|
||||||
write!(
|
write!(
|
||||||
self.sql,
|
self.sql,
|
||||||
concat!(
|
concat!(
|
||||||
"(SELECT min(id) > {cutoff} FROM revlog WHERE cid = c.id ",
|
"((SELECT coalesce(min(id) > {cutoff}, false) FROM revlog WHERE cid = c.id ",
|
||||||
// Exclude manual reschedulings
|
// Exclude manual reschedulings
|
||||||
"AND ease != 0) ",
|
"AND ease != 0) ",
|
||||||
// Logically redundant, speeds up query
|
// Logically redundant, speeds up query
|
||||||
"AND c.id IN (SELECT cid FROM revlog WHERE id > {cutoff})"
|
"AND c.id IN (SELECT cid FROM revlog WHERE id > {cutoff}))"
|
||||||
),
|
),
|
||||||
cutoff = cutoff,
|
cutoff = cutoff,
|
||||||
)
|
)
|
||||||
|
@ -785,8 +785,8 @@ mod test {
|
||||||
s(ctx, "introduced:3").0,
|
s(ctx, "introduced:3").0,
|
||||||
format!(
|
format!(
|
||||||
concat!(
|
concat!(
|
||||||
"((SELECT min(id) > {cutoff} FROM revlog WHERE cid = c.id AND ease != 0) ",
|
"(((SELECT coalesce(min(id) > {cutoff}, false) FROM revlog WHERE cid = c.id AND ease != 0) ",
|
||||||
"AND c.id IN (SELECT cid FROM revlog WHERE id > {cutoff}))"
|
"AND c.id IN (SELECT cid FROM revlog WHERE id > {cutoff})))"
|
||||||
),
|
),
|
||||||
cutoff = (timing.next_day_at.0 - (86_400 * 3)) * 1_000,
|
cutoff = (timing.next_day_at.0 - (86_400 * 3)) * 1_000,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue