update sort field when field moved

This commit is contained in:
Damien Elmes 2012-04-21 06:40:20 +09:00
parent c2df347909
commit 7c51a7bb16
2 changed files with 3 additions and 3 deletions

View file

@ -252,6 +252,7 @@ select id from cards where nid in (select id from notes where mid = ?)""",
return return
m['flds'].remove(field) m['flds'].remove(field)
m['flds'].insert(idx, field) m['flds'].insert(idx, field)
m['sortf'] = idx
self._updateFieldOrds(m) self._updateFieldOrds(m)
self.save(m) self.save(m)
def move(fields, oldidx=oldidx): def move(fields, oldidx=oldidx):

View file

@ -80,12 +80,11 @@ def test_sync():
assert deck1.mod == deck1.ls assert deck1.mod == deck1.ls
assert deck1._usn != origUsn assert deck1._usn != origUsn
# because everything was created separately it will be merged in. in # because everything was created separately it will be merged in. in
# actual use we use a full sync to ensure initial a common starting point. # actual use, we use a full sync to ensure a common starting point.
check(2) check(2)
# repeating it does nothing # repeating it does nothing
assert client.sync() == "noChanges" assert client.sync() == "noChanges"
# if we bump mod time, everything is copied across again because of the # if we bump mod time, the decks will sync but should remain the same.
# 600 second sync leeway. but the decks should remain the same.
deck1.setMod() deck1.setMod()
deck1.save() deck1.save()
assert client.sync() == "success" assert client.sync() == "success"