From 7c51a7bb16427d6ee110982a43da54581f3c1ba3 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 21 Apr 2012 06:40:20 +0900 Subject: [PATCH] update sort field when field moved --- anki/models.py | 1 + tests/test_sync.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/anki/models.py b/anki/models.py index 4edc4e989..77d6cea1b 100644 --- a/anki/models.py +++ b/anki/models.py @@ -252,6 +252,7 @@ select id from cards where nid in (select id from notes where mid = ?)""", return m['flds'].remove(field) m['flds'].insert(idx, field) + m['sortf'] = idx self._updateFieldOrds(m) self.save(m) def move(fields, oldidx=oldidx): diff --git a/tests/test_sync.py b/tests/test_sync.py index dccb3b928..58c1cf42e 100644 --- a/tests/test_sync.py +++ b/tests/test_sync.py @@ -80,12 +80,11 @@ def test_sync(): assert deck1.mod == deck1.ls assert deck1._usn != origUsn # 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) # repeating it does nothing assert client.sync() == "noChanges" - # if we bump mod time, everything is copied across again because of the - # 600 second sync leeway. but the decks should remain the same. + # if we bump mod time, the decks will sync but should remain the same. deck1.setMod() deck1.save() assert client.sync() == "success"