mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
fix error when gathering new cards in reverse position
Also simplify order clause - with did and queue limited to a constant, SQLite is smart enough to use the covering index for sorting by due.
This commit is contained in:
parent
fcb21ceed5
commit
d515939340
2 changed files with 3 additions and 6 deletions
|
@ -241,9 +241,9 @@ impl super::SqliteStorage {
|
||||||
F: FnMut(NewCard) -> bool,
|
F: FnMut(NewCard) -> bool,
|
||||||
{
|
{
|
||||||
let mut stmt = self.db.prepare_cached(&format!(
|
let mut stmt = self.db.prepare_cached(&format!(
|
||||||
"{}{}",
|
"{} ORDER BY {}",
|
||||||
include_str!("new_cards.sql"),
|
include_str!("new_cards.sql"),
|
||||||
if reverse { " order by due desc" } else { "" }
|
if reverse { "due desc" } else { "due asc" }
|
||||||
))?;
|
))?;
|
||||||
let mut rows = stmt.query(params![deck])?;
|
let mut rows = stmt.query(params![deck])?;
|
||||||
while let Some(row) = rows.next()? {
|
while let Some(row) = rows.next()? {
|
||||||
|
|
|
@ -7,6 +7,3 @@ SELECT id,
|
||||||
FROM cards
|
FROM cards
|
||||||
WHERE did = ?
|
WHERE did = ?
|
||||||
AND queue = 0
|
AND queue = 0
|
||||||
ORDER BY did,
|
|
||||||
queue,
|
|
||||||
due
|
|
Loading…
Reference in a new issue