mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
add change card model, fix bug in check db
This commit is contained in:
parent
39810aa3d0
commit
8e71b5fbbf
1 changed files with 10 additions and 4 deletions
14
anki/deck.py
14
anki/deck.py
|
@ -1250,6 +1250,7 @@ order by fields.factId""" % ids2str([x[2] for x in ids])),
|
||||||
question = :question, answer = :answer
|
question = :question, answer = :answer
|
||||||
%s
|
%s
|
||||||
where id = :id""" % mod, pend)
|
where id = :id""" % mod, pend)
|
||||||
|
self.flushMod()
|
||||||
|
|
||||||
def rebuildCardOrdinals(self, ids):
|
def rebuildCardOrdinals(self, ids):
|
||||||
"Update all card models in IDS. Caller must update model modtime."
|
"Update all card models in IDS. Caller must update model modtime."
|
||||||
|
@ -1262,6 +1263,13 @@ modified = :now
|
||||||
where cardModelId in %s""" % strids, now=time.time())
|
where cardModelId in %s""" % strids, now=time.time())
|
||||||
self.flushMod()
|
self.flushMod()
|
||||||
|
|
||||||
|
def changeCardModel(self, cardIds, newCardModelId):
|
||||||
|
self.s.statement("""
|
||||||
|
update cards set cardModelId = :newId
|
||||||
|
where id in %s""" % ids2str(cardIds), newId=newCardModelId)
|
||||||
|
self.updateCardQACacheFromIds(cardIds)
|
||||||
|
self.flushMod()
|
||||||
|
|
||||||
# Tags
|
# Tags
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
@ -1594,10 +1602,8 @@ select id from fields where factId not in (select id from facts)""")
|
||||||
# these sometimes end up null on upgrade
|
# these sometimes end up null on upgrade
|
||||||
self.s.statement("update models set source = 0 where source is null")
|
self.s.statement("update models set source = 0 where source is null")
|
||||||
self.s.statement(
|
self.s.statement(
|
||||||
"update cardModels set allowEmptyAnswer = 1 "
|
"update cardModels set allowEmptyAnswer = 1, typeAnswer = 0 "
|
||||||
"where allowEmptyAnswer is null")
|
"where allowEmptyAnswer is null or typeAnswer is null")
|
||||||
self.s.statement(
|
|
||||||
"update cardModels set typeAnswer = 0 where typeAnswer is null")
|
|
||||||
# fix any priorities
|
# fix any priorities
|
||||||
self.updateAllPriorities()
|
self.updateAllPriorities()
|
||||||
# fix problems with stripping html
|
# fix problems with stripping html
|
||||||
|
|
Loading…
Reference in a new issue