From 645f6714d2a7fc7e747aeee9f4a7150770e7d8d1 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 11 Nov 2017 12:11:45 +1000 Subject: [PATCH] favour most recent modified when importing template changes --- anki/importing/anki2.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/anki/importing/anki2.py b/anki/importing/anki2.py index 0c7739be5..d938f0ff4 100644 --- a/anki/importing/anki2.py +++ b/anki/importing/anki2.py @@ -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