must preserve selected card order when repositioning

This commit is contained in:
Damien Elmes 2012-08-23 15:09:10 +09:00
parent d001b83ab1
commit 500dff04c8

View file

@ -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