mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
fix importing with schema change logic
the previous fix for #612 was broken, and led to notes with altered schemas being imported with the incorrect schema
This commit is contained in:
parent
f7c841fba2
commit
0fa9b75af5
1 changed files with 4 additions and 2 deletions
|
@ -111,14 +111,16 @@ class Anki2Importer(Importer):
|
||||||
srcMid = note[MID]
|
srcMid = note[MID]
|
||||||
dstMid = self._mid(srcMid)
|
dstMid = self._mid(srcMid)
|
||||||
# duplicate schemas?
|
# duplicate schemas?
|
||||||
if srcMid == dstMid or not self.dupeOnSchemaChange:
|
if srcMid == dstMid:
|
||||||
return origGuid not in self._notes
|
return origGuid not in self._notes
|
||||||
# differing schemas
|
# differing schemas and note doesn't exist?
|
||||||
note[MID] = dstMid
|
note[MID] = dstMid
|
||||||
if origGuid not in self._notes:
|
if origGuid not in self._notes:
|
||||||
return True
|
return True
|
||||||
# as the schemas differ and we already have a note with a different
|
# as the schemas differ and we already have a note with a different
|
||||||
# note type, this note needs a new guid
|
# note type, this note needs a new guid
|
||||||
|
if not self.dupeOnSchemaChange:
|
||||||
|
return False
|
||||||
while True:
|
while True:
|
||||||
note[GUID] = incGuid(note[GUID])
|
note[GUID] = incGuid(note[GUID])
|
||||||
self._changedGuids[origGuid] = note[GUID]
|
self._changedGuids[origGuid] = note[GUID]
|
||||||
|
|
Loading…
Reference in a new issue