mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
favour most recent modified when importing template changes
This commit is contained in:
parent
e0d05e49d6
commit
645f6714d2
1 changed files with 6 additions and 7 deletions
|
@ -176,7 +176,6 @@ class Anki2Importer(Importer):
|
||||||
# copy it over
|
# copy it over
|
||||||
model = srcModel.copy()
|
model = srcModel.copy()
|
||||||
model['id'] = mid
|
model['id'] = mid
|
||||||
model['mod'] = intTime()
|
|
||||||
model['usn'] = self.col.usn()
|
model['usn'] = self.col.usn()
|
||||||
self.dst.models.update(model)
|
self.dst.models.update(model)
|
||||||
break
|
break
|
||||||
|
@ -184,12 +183,12 @@ class Anki2Importer(Importer):
|
||||||
dstModel = self.dst.models.get(mid)
|
dstModel = self.dst.models.get(mid)
|
||||||
dstScm = self.dst.models.scmhash(dstModel)
|
dstScm = self.dst.models.scmhash(dstModel)
|
||||||
if srcScm == dstScm:
|
if srcScm == dstScm:
|
||||||
# they do; we can reuse this mid
|
# copy styling changes over if newer
|
||||||
model = srcModel.copy()
|
if srcModel['mod'] > dstModel['mod']:
|
||||||
model['id'] = mid
|
model = srcModel.copy()
|
||||||
model['mod'] = intTime()
|
model['id'] = mid
|
||||||
model['usn'] = self.col.usn()
|
model['usn'] = self.col.usn()
|
||||||
self.dst.models.update(model)
|
self.dst.models.update(model)
|
||||||
break
|
break
|
||||||
# as they don't match, try next id
|
# as they don't match, try next id
|
||||||
mid += 1
|
mid += 1
|
||||||
|
|
Loading…
Reference in a new issue