mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
must preserve selected card order when repositioning
This commit is contained in:
parent
d001b83ab1
commit
500dff04c8
1 changed files with 7 additions and 3 deletions
|
@ -1222,9 +1222,13 @@ usn=:usn, mod=:mod, factor=:fact where id=:id and odid=0""",
|
||||||
def sortCards(self, cids, start=1, step=1, shuffle=False, shift=False):
|
def sortCards(self, cids, start=1, step=1, shuffle=False, shift=False):
|
||||||
scids = ids2str(cids)
|
scids = ids2str(cids)
|
||||||
now = intTime()
|
now = intTime()
|
||||||
nids = self.col.db.list(
|
nids = []
|
||||||
("select distinct nid from cards where type = 0 and id in %s "
|
nidsSet = set()
|
||||||
"order by nid") % scids)
|
for id in cids:
|
||||||
|
nid = self.col.db.scalar("select nid from cards where id = ?", id)
|
||||||
|
if nid not in nidsSet:
|
||||||
|
nids.append(nid)
|
||||||
|
nidsSet.add(nid)
|
||||||
if not nids:
|
if not nids:
|
||||||
# no new cards
|
# no new cards
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue