upgrade suspended, but don't mark cards dirty and don't delete from suspended

This commit is contained in:
Damien Elmes 2009-06-19 10:26:54 +09:00
parent f96a7a7c5b
commit aca3ea2513

View file

@ -55,7 +55,7 @@ SEARCH_TAG = 0
SEARCH_TYPE = 1 SEARCH_TYPE = 1
SEARCH_PHRASE = 2 SEARCH_PHRASE = 2
SEARCH_FID = 3 SEARCH_FID = 3
DECK_VERSION = 38 DECK_VERSION = 39
deckVarsTable = Table( deckVarsTable = Table(
'deckVars', metadata, 'deckVars', metadata,
@ -3198,9 +3198,21 @@ nextFactor, reps, thinkingTime, yesCount, noCount from reviewHistory""")
deck.failedCardMax = 0 deck.failedCardMax = 0
deck.version = 37 deck.version = 37
deck.s.commit() deck.s.commit()
if deck.version < 38: # skip 38
# don't automatically upgrade suspended if deck.version < 39:
deck.version = 38 deck.rebuildQueue()
# manually suspend all suspended cards
ids = deck.findCards("tag:suspended")
if ids:
# unrolled from suspendCards() to avoid marking dirty
deck.s.statement(
"update cards set isDue=0, priority=-3 "
"where id in %s" % ids2str(ids))
deck.rebuildCounts(full=False)
# suspended tag obsolete - don't do this yet
#deck.suspended = re.sub(u" ?Suspended ?", u"", deck.suspended)
#deck.updateTagPriorities()
deck.version = 39
deck.s.commit() deck.s.commit()
# executing a pragma here is very slow on large decks, so we store # executing a pragma here is very slow on large decks, so we store
# our own record # our own record