fix import of suspended anki1 cards (#565)

This commit is contained in:
Damien Elmes 2013-01-23 15:28:11 +09:00
parent 0a0d6bcfe6
commit 17b68d5dc0
3 changed files with 11 additions and 1 deletions

View File

@ -256,7 +256,7 @@ class Anki2Importer(Importer):
card[4] = intTime() card[4] = intTime()
card[5] = usn card[5] = usn
# review cards have a due date relative to collection # review cards have a due date relative to collection
if card[7] in (2, 3): if card[7] in (2, 3) or card[6] == 2:
card[8] -= aheadBy card[8] -= aheadBy
# if odid true, convert card from filtered to normal # if odid true, convert card from filtered to normal
if card[15]: if card[15]:

Binary file not shown.

View File

@ -163,6 +163,16 @@ def test_anki1_diffmodels():
assert after == before + 1 assert after == before + 1
assert beforeModels == len(dst.models.all()) assert beforeModels == len(dst.models.all())
def test_suspended():
# create a new empty deck
dst = getEmptyDeck()
# import the 1 card version of the model
tmp = getUpgradeDeckPath("suspended12.anki")
imp = Anki1Importer(dst, tmp)
imp.run()
assert dst.db.scalar("select due from cards") < 0
def test_anki2_diffmodels(): def test_anki2_diffmodels():
# create a new empty deck # create a new empty deck
dst = getEmptyDeck() dst = getEmptyDeck()