mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
fixIntegrity() tweaks
- fix card ordinals too - don't change modification time on cards, facts or models - mark schema modified to force full sync
This commit is contained in:
parent
9355e9b98d
commit
73d83bc640
1 changed files with 6 additions and 7 deletions
13
anki/deck.py
13
anki/deck.py
|
@ -3350,11 +3350,14 @@ select id from fields where factId not in (select id from facts)""")
|
|||
# fix any priorities
|
||||
self.updateProgress(_("Updating priorities..."))
|
||||
self.updateAllPriorities(dirty=False)
|
||||
# make sure
|
||||
# make sure ordinals are correct
|
||||
self.updateProgress(_("Updating ordinals..."))
|
||||
self.s.statement("""
|
||||
update fields set ordinal = (select ordinal from fieldModels
|
||||
where id = fieldModelId)""")
|
||||
self.s.statement("""
|
||||
update cards set ordinal = (select ordinal from cardModels
|
||||
where cards.cardModelId = cardModels.id)""")
|
||||
# fix problems with stripping html
|
||||
self.updateProgress(_("Rebuilding QA cache..."))
|
||||
fields = self.s.all("select id, value from fields")
|
||||
|
@ -3367,15 +3370,11 @@ where id = fieldModelId)""")
|
|||
# regenerate question/answer cache
|
||||
for m in self.models:
|
||||
self.updateCardsFromModel(m, dirty=False)
|
||||
# force a full sync
|
||||
self.s.flush()
|
||||
self.s.statement("update cards set modified = :t", t=time.time())
|
||||
self.s.statement("update facts set modified = :t", t=time.time())
|
||||
self.s.statement("update models set modified = :t", t=time.time())
|
||||
self.lastSync = 0
|
||||
# rebuild
|
||||
self.updateProgress(_("Rebuilding types..."))
|
||||
self.rebuildTypes()
|
||||
# force a full sync
|
||||
self.setSchemaModified()
|
||||
# update deck and save
|
||||
if not quick:
|
||||
self.flushMod()
|
||||
|
|
Loading…
Reference in a new issue