mirror of
https://github.com/ankitects/anki.git
synced 2025-11-08 21:57:12 -05:00
fix cloze->basic model changing
This commit is contained in:
parent
7aa9691334
commit
57a9668350
2 changed files with 6 additions and 1 deletions
|
|
@ -422,7 +422,7 @@ select id from notes where mid = ?)""" % " ".join(map),
|
||||||
if newModel['type'] != MODEL_CLOZE:
|
if newModel['type'] != MODEL_CLOZE:
|
||||||
# if we're mapping to a regular note, we need to check if
|
# if we're mapping to a regular note, we need to check if
|
||||||
# the destination ord is valid
|
# the destination ord is valid
|
||||||
if len(newModel['flds']) <= ord:
|
if len(newModel['tmpls']) <= ord:
|
||||||
new = None
|
new = None
|
||||||
else:
|
else:
|
||||||
# mapping from a regular note, so the map should be valid
|
# mapping from a regular note, so the map should be valid
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,11 @@ def test_modelChange():
|
||||||
f.load()
|
f.load()
|
||||||
assert f['Text'] == "f2"
|
assert f['Text'] == "f2"
|
||||||
assert len(f.cards()) == 2
|
assert len(f.cards()) == 2
|
||||||
|
# back the other way, with deletion of second ord
|
||||||
|
deck.models.remTemplate(basic, basic['tmpls'][1])
|
||||||
|
assert deck.db.scalar("select count() from cards where nid = ?", f.id) == 2
|
||||||
|
deck.models.change(cloze, [f.id], basic, map, map)
|
||||||
|
assert deck.db.scalar("select count() from cards where nid = ?", f.id) == 1
|
||||||
|
|
||||||
def test_availOrds():
|
def test_availOrds():
|
||||||
d = getEmptyDeck()
|
d = getEmptyDeck()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue