mirror of
https://github.com/ankitects/anki.git
synced 2025-11-24 21:47:13 -05:00
* Expose original position to columns and card info * Fix contributors * Change routine name and return, fix SQL file, utilize coalesce inline * Handle cards without original position * Remove unecessary conversion
16 lines
No EOL
313 B
SQL
16 lines
No EOL
313 B
SQL
DROP TABLE IF EXISTS sort_order;
|
|
CREATE TEMPORARY TABLE sort_order (
|
|
pos integer PRIMARY KEY,
|
|
nid integer NOT NULL UNIQUE
|
|
);
|
|
INSERT INTO sort_order (nid)
|
|
SELECT nid
|
|
FROM cards
|
|
GROUP BY nid
|
|
ORDER BY COALESCE(
|
|
extract_original_position(data),
|
|
CASE
|
|
WHEN type == 0 THEN due
|
|
ELSE 0
|
|
END
|
|
); |