From ebac628187d5503827f75c57125b028459358ddc Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 26 Aug 2011 22:33:24 +0900 Subject: [PATCH] ensure duplicate model creation times are accounted for --- anki/storage.py | 4 ++++ tests/support/anki12.anki | Bin 196608 -> 196608 bytes 2 files changed, 4 insertions(+) diff --git a/anki/storage.py b/anki/storage.py index 59f5ac130..92d470842 100644 --- a/anki/storage.py +++ b/anki/storage.py @@ -511,12 +511,16 @@ def _fixupModels(deck): # rewrite model/template/field ids models = deck.models() deck.db.execute("delete from models") + times = {} for c, m in enumerate(models.values()): # update ordinals m._updateFieldOrds() m._updateTemplOrds() # we've temporarily stored the model creation time in the mod time old = m.id + while m.mod in times: + m.mod += 1 + times[m.mod] = True m.id = m.mod m.mod = intTime() m.flush() diff --git a/tests/support/anki12.anki b/tests/support/anki12.anki index 3ee5fe744f6d325a004594dce901cbc5bf0e04e3..042ecf4f4ca7fb6ce0efc235bb3540ca93ba3530 100644 GIT binary patch delta 37 tcmZo@;Av>!nIO%`K2gS*k$q!=Q$GtQTP<_*vi|mE{fyg}^)p2k007qE3}yfT delta 37 tcmZo@;Av>!nIO%`Hc`fzk!@pwQ$GuD$qd`(W&Q2T`Wd$`>t~880082X4J!Zu