Merge pull request #271 from Arthur-Milchior/quickerMoveTemplate

moveTemplate slightly quicker
This commit is contained in:
Damien Elmes 2019-01-21 14:27:54 +10:00 committed by GitHub
commit fcfb45ccdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -397,7 +397,10 @@ update cards set ord = ord - 1, usn = ?, mod = ?
# generate change map # generate change map
map = [] map = []
for t in m['tmpls']: for t in m['tmpls']:
map.append("when ord = %d then %d" % (oldidxs[id(t)], t['ord'])) oldidx = oldidxs[id(t)]
newidx = t['ord']
if oldidx != newidx:
map.append("when ord = %d then %d" % (oldidx, newidx))
# apply # apply
self.save(m) self.save(m)
self.col.db.execute(""" self.col.db.execute("""