mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
fix updatePriorities(), etc
This commit is contained in:
parent
0b1a135176
commit
0d2429bee8
1 changed files with 12 additions and 13 deletions
25
anki/deck.py
25
anki/deck.py
|
@ -711,8 +711,11 @@ and priority in (1,2,3,4) and type in (0, 1)""", time=time)
|
||||||
# Priorities
|
# Priorities
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
# for e in extraExcludes:
|
def updateAllPriorities(self):
|
||||||
# tagCache['suspended'][e] = 1
|
"Update all card priorities if changed."
|
||||||
|
self.updateTagPriorities()
|
||||||
|
self.updateAllPrioritiesForTags(self.s.all(
|
||||||
|
"select id, priority as pri from tags"))
|
||||||
|
|
||||||
def updateTagPriorities(self):
|
def updateTagPriorities(self):
|
||||||
"Update priority setting on tags table."
|
"Update priority setting on tags table."
|
||||||
|
@ -735,15 +738,6 @@ and priority in (1,2,3,4) and type in (0, 1)""", time=time)
|
||||||
new)
|
new)
|
||||||
return new
|
return new
|
||||||
|
|
||||||
def updateAllPriorities(self, extraExcludes=[], where="", force=False):
|
|
||||||
"Update all card priorities if changed."
|
|
||||||
t = time.time()
|
|
||||||
new = self.updateTagPriorities()
|
|
||||||
if force:
|
|
||||||
new = self.s.all("select id, priority as pri from tags")
|
|
||||||
self.updateAllPrioritiesForTags(new)
|
|
||||||
#print "update all", time.time() - t
|
|
||||||
|
|
||||||
def updateAllPrioritiesForTags(self, new):
|
def updateAllPrioritiesForTags(self, new):
|
||||||
if new:
|
if new:
|
||||||
seen = {}
|
seen = {}
|
||||||
|
@ -761,7 +755,12 @@ where id in %s""" % ids2str(ids), c=c)
|
||||||
"update cards set isDue = 0 where type in (0,1,2) and "
|
"update cards set isDue = 0 where type in (0,1,2) and "
|
||||||
"priority = 0 and isDue = 1")
|
"priority = 0 and isDue = 1")
|
||||||
|
|
||||||
def updatePriorities(self, cardIds):
|
def updatePriorities(self, cardIds, suspend=[]):
|
||||||
|
# any tags to suspend
|
||||||
|
ids = tagIds(self.s, suspend)
|
||||||
|
self.s.statement(
|
||||||
|
"update tags set priority = 0 where id in %s" %
|
||||||
|
ids2str(ids))
|
||||||
t = time.time()
|
t = time.time()
|
||||||
cards = self.s.all("""
|
cards = self.s.all("""
|
||||||
select cardTags.cardId,
|
select cardTags.cardId,
|
||||||
|
@ -1974,7 +1973,7 @@ select id from fields where factId not in (select id from facts)""")
|
||||||
self.updateCardTags()
|
self.updateCardTags()
|
||||||
# fix any priorities
|
# fix any priorities
|
||||||
self.updateProgress(_("Updating priorities..."))
|
self.updateProgress(_("Updating priorities..."))
|
||||||
self.updateAllPriorities()
|
self.updateAllPriorities(force=True)
|
||||||
# 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")
|
||||||
|
|
Loading…
Reference in a new issue