mirror of
https://github.com/ankitects/anki.git
synced 2025-11-14 00:27:13 -05:00
same with card upgrade
This commit is contained in:
parent
34ba8e18f1
commit
38ec009378
1 changed files with 6 additions and 4 deletions
|
|
@ -192,9 +192,9 @@ select id, id, modelId, 1, cast(created*1000 as int), cast(modified as int),
|
||||||
###########
|
###########
|
||||||
# we need to pull this into memory, to rewrite the creation time if
|
# we need to pull this into memory, to rewrite the creation time if
|
||||||
# it's not unique and update the fact id
|
# it's not unique and update the fact id
|
||||||
times = {}
|
|
||||||
rows = []
|
rows = []
|
||||||
cardidmap = {}
|
cardidmap = {}
|
||||||
|
highest = 0
|
||||||
for row in db.execute("""
|
for row in db.execute("""
|
||||||
select id, cast(created*1000 as int), factId, ordinal,
|
select id, cast(created*1000 as int), factId, ordinal,
|
||||||
cast(modified as int), 0,
|
cast(modified as int), 0,
|
||||||
|
|
@ -212,9 +212,11 @@ cast(factor*1000 as int), reps, noCount from cards
|
||||||
order by created"""):
|
order by created"""):
|
||||||
# find an unused time
|
# find an unused time
|
||||||
row = list(row)
|
row = list(row)
|
||||||
while row[1] in times:
|
if row[1] <= highest:
|
||||||
row[1] += 1000
|
highest = max(highest, row[1]) + 1
|
||||||
times[row[1]] = True
|
row[1] = highest
|
||||||
|
else:
|
||||||
|
highest = row[1]
|
||||||
# rewrite fact id
|
# rewrite fact id
|
||||||
row[2] = factidmap[row[2]]
|
row[2] = factidmap[row[2]]
|
||||||
# note id change and save all but old id
|
# note id change and save all but old id
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue