favour most recent modified when importing template changes

This commit is contained in:
Damien Elmes 2017-11-11 12:11:45 +10:00
parent e0d05e49d6
commit 645f6714d2

View file

@ -176,7 +176,6 @@ class Anki2Importer(Importer):
# copy it over
model = srcModel.copy()
model['id'] = mid
model['mod'] = intTime()
model['usn'] = self.col.usn()
self.dst.models.update(model)
break
@ -184,12 +183,12 @@ class Anki2Importer(Importer):
dstModel = self.dst.models.get(mid)
dstScm = self.dst.models.scmhash(dstModel)
if srcScm == dstScm:
# they do; we can reuse this mid
model = srcModel.copy()
model['id'] = mid
model['mod'] = intTime()
model['usn'] = self.col.usn()
self.dst.models.update(model)
# copy styling changes over if newer
if srcModel['mod'] > dstModel['mod']:
model = srcModel.copy()
model['id'] = mid
model['usn'] = self.col.usn()
self.dst.models.update(model)
break
# as they don't match, try next id
mid += 1