mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
improve duplicate handling of note ids on upgrade
This commit is contained in:
parent
057b13e0af
commit
34ba8e18f1
1 changed files with 6 additions and 5 deletions
|
@ -164,15 +164,16 @@ select id, id, modelId, 1, cast(created*1000 as int), cast(modified as int),
|
||||||
map = {}
|
map = {}
|
||||||
data = []
|
data = []
|
||||||
factidmap = {}
|
factidmap = {}
|
||||||
times = {}
|
|
||||||
from anki.utils import minimizeHTML
|
from anki.utils import minimizeHTML
|
||||||
|
highest = 0
|
||||||
for c, row in enumerate(facts):
|
for c, row in enumerate(facts):
|
||||||
oldid = row[0]
|
oldid = row[0]
|
||||||
row = list(row)
|
row = list(row)
|
||||||
# get rid of old created column and update id
|
if row[4] <= highest:
|
||||||
while row[4] in times:
|
highest = max(highest, row[4]) + 1
|
||||||
row[4] += 1000
|
row[4] = highest
|
||||||
times[row[4]] = True
|
else:
|
||||||
|
highest = row[4]
|
||||||
factidmap[row[0]] = row[4]
|
factidmap[row[0]] = row[4]
|
||||||
row[0] = row[4]
|
row[0] = row[4]
|
||||||
del row[4]
|
del row[4]
|
||||||
|
|
Loading…
Reference in a new issue