mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -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
|
# fix any priorities
|
||||||
self.updateProgress(_("Updating priorities..."))
|
self.updateProgress(_("Updating priorities..."))
|
||||||
self.updateAllPriorities(dirty=False)
|
self.updateAllPriorities(dirty=False)
|
||||||
# make sure
|
# make sure ordinals are correct
|
||||||
self.updateProgress(_("Updating ordinals..."))
|
self.updateProgress(_("Updating ordinals..."))
|
||||||
self.s.statement("""
|
self.s.statement("""
|
||||||
update fields set ordinal = (select ordinal from fieldModels
|
update fields set ordinal = (select ordinal from fieldModels
|
||||||
where id = fieldModelId)""")
|
where id = fieldModelId)""")
|
||||||
|
self.s.statement("""
|
||||||
|
update cards set ordinal = (select ordinal from cardModels
|
||||||
|
where cards.cardModelId = cardModels.id)""")
|
||||||
# fix problems with stripping html
|
# fix problems with stripping html
|
||||||
self.updateProgress(_("Rebuilding QA cache..."))
|
self.updateProgress(_("Rebuilding QA cache..."))
|
||||||
fields = self.s.all("select id, value from fields")
|
fields = self.s.all("select id, value from fields")
|
||||||
|
@ -3367,15 +3370,11 @@ where id = fieldModelId)""")
|
||||||
# regenerate question/answer cache
|
# regenerate question/answer cache
|
||||||
for m in self.models:
|
for m in self.models:
|
||||||
self.updateCardsFromModel(m, dirty=False)
|
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
|
# rebuild
|
||||||
self.updateProgress(_("Rebuilding types..."))
|
self.updateProgress(_("Rebuilding types..."))
|
||||||
self.rebuildTypes()
|
self.rebuildTypes()
|
||||||
|
# force a full sync
|
||||||
|
self.setSchemaModified()
|
||||||
# update deck and save
|
# update deck and save
|
||||||
if not quick:
|
if not quick:
|
||||||
self.flushMod()
|
self.flushMod()
|
||||||
|
|
Loading…
Reference in a new issue