mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04: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 we're mapping to a regular note, we need to check if
|
||||
# the destination ord is valid
|
||||
if len(newModel['flds']) <= ord:
|
||||
if len(newModel['tmpls']) <= ord:
|
||||
new = None
|
||||
else:
|
||||
# mapping from a regular note, so the map should be valid
|
||||
|
|
|
@ -231,6 +231,11 @@ def test_modelChange():
|
|||
f.load()
|
||||
assert f['Text'] == "f2"
|
||||
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():
|
||||
d = getEmptyDeck()
|
||||
|
|
Loading…
Reference in a new issue