mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
fix field deletion issues thanks to illforyou
This commit is contained in:
parent
74700ff4f5
commit
71645aacb5
1 changed files with 3 additions and 1 deletions
|
@ -231,6 +231,8 @@ select id from cards where nid in (select id from notes where mid = ?)""",
|
|||
self.col.modSchema()
|
||||
idx = m['flds'].index(field)
|
||||
m['flds'].remove(field)
|
||||
if m['sortf'] >= len(m['flds']):
|
||||
m['sortf'] -= 1
|
||||
self._updateFieldOrds(m)
|
||||
def delete(fields):
|
||||
del fields[idx]
|
||||
|
@ -238,7 +240,7 @@ select id from cards where nid in (select id from notes where mid = ?)""",
|
|||
self._transformFields(m, delete)
|
||||
if idx == self.sortIdx(m):
|
||||
# need to rebuild
|
||||
self.col.updateFieldCache(self.nids(m), csum=False)
|
||||
self.col.updateFieldCache(self.nids(m))
|
||||
# saves
|
||||
self.renameField(m, field, None)
|
||||
|
||||
|
|
Loading…
Reference in a new issue