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
@ -241,9 +241,9 @@ impl super::SqliteStorage {
|
||||
F: FnMut(NewCard) -> bool,
|
||||
{
|
||||
let mut stmt = self.db.prepare_cached(&format!(
|
||||
"{}{}",
|
||||
"{} ORDER BY {}",
|
||||
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])?;
|
||||
while let Some(row) = rows.next()? {
|
||||
|
@ -6,7 +6,4 @@ SELECT id,
|
||||
odid
|
||||
FROM cards
|
||||
WHERE did = ?
|
||||
AND queue = 0
|
||||
ORDER BY did,
|
||||
queue,
|
||||
due
|
||||
AND queue = 0
|
Loading…
Reference in New Issue
Block a user