mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
fix due # rewriting and correctly set nextPos
This commit is contained in:
parent
3dc9454cd7
commit
057b13e0af
1 changed files with 5 additions and 9 deletions
|
@ -627,15 +627,15 @@ and ord = ? limit 1""", m['id'], t['ord']):
|
|||
def _rewriteNewDue(self):
|
||||
col = self.col
|
||||
pos = 0
|
||||
lastDue = None
|
||||
data = []
|
||||
for id, due in col.db.execute(
|
||||
"select id, due from cards where type = 0"):
|
||||
if due != lastDue:
|
||||
pos += 1
|
||||
lastDue = due
|
||||
"select id, due from cards where type = 0 order by id"):
|
||||
pos += 1
|
||||
data.append((pos, id))
|
||||
col.db.executemany("update cards set due = ? where id = ?", data)
|
||||
# update insertion id
|
||||
col.conf['nextPos'] = pos + 1
|
||||
col.save()
|
||||
|
||||
# Post-schema upgrade
|
||||
######################################################################
|
||||
|
@ -694,10 +694,6 @@ update cards set due = cast(
|
|||
conf = col.decks.allConf()[0]
|
||||
if not conf['new']['order']:
|
||||
col.sched.randomizeCards(1)
|
||||
# update insertion id
|
||||
col.conf['nextPos'] = (
|
||||
col.db.scalar("select max(id) from notes") or 0)+1
|
||||
col.save()
|
||||
# optimize and finish
|
||||
col.db.commit()
|
||||
col.db.execute("vacuum")
|
||||
|
|
Loading…
Reference in a new issue