From 9baa3e197a7ed211830b7ab85eefb91f59dc5a75 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 18 Oct 2013 10:38:29 +0900 Subject: [PATCH] add option to disable burying of reviews --- anki/decks.py | 2 ++ anki/sched.py | 15 ++++++++---- aqt/deckconf.py | 6 +++-- designer/dconf.ui | 60 +++++++++++++++++++++++++++-------------------- 4 files changed, 51 insertions(+), 32 deletions(-) diff --git a/anki/decks.py b/anki/decks.py index 41fe720ed..aa170b670 100644 --- a/anki/decks.py +++ b/anki/decks.py @@ -71,6 +71,8 @@ defaultConf = { 'minSpace': 1, # not currently used 'ivlFct': 1, 'maxIvl': 36500, + # may not be set on old decks + 'bury': True, }, 'maxTaken': 60, 'timer': 0, diff --git a/anki/sched.py b/anki/sched.py index 8fc61dff6..d9f068bcf 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -3,9 +3,12 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from __future__ import division -import time, random, itertools +import time +import random +import itertools from operator import itemgetter from heapq import * + #from anki.cards import Card from anki.utils import ids2str, intTime, fmtTimeSpan from anki.lang import _ @@ -1266,15 +1269,19 @@ update cards set queue=-2,mod=?,usn=? where id in """+ids2str(cids), def _burySiblings(self, card): toBury = [] - conf = self._newConf(card) - buryNew = conf.get("bury", True) + nconf = self._newConf(card) + buryNew = nconf.get("bury", True) + rconf = self._revConf(card) + buryRev = rconf.get("bury", True) # loop through and remove from queues for cid,queue in self.col.db.execute(""" select id, queue from cards where nid=? and id!=? and (queue=0 or (queue=2 and due<=?))""", card.nid, card.id, self.today): if queue == 2: - toBury.append(cid) + if buryRev: + toBury.append(cid) + # if bury disabled, we still discard to give same-day spacing try: self._revQueue.remove(cid) except ValueError: diff --git a/aqt/deckconf.py b/aqt/deckconf.py index 5e4e442f6..3404bc703 100644 --- a/aqt/deckconf.py +++ b/aqt/deckconf.py @@ -1,13 +1,13 @@ # Copyright: Damien Elmes # -*- coding: utf-8 -*- # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from anki.consts import NEW_CARDS_RANDOM +from operator import itemgetter +from anki.consts import NEW_CARDS_RANDOM from aqt.qt import * import aqt from aqt.utils import showInfo, showWarning, openHelp, getOnlyText, askUser, \ tooltip -from operator import itemgetter class DeckConf(QDialog): def __init__(self, mw, deck): @@ -189,6 +189,7 @@ class DeckConf(QDialog): f.fi1.setValue(c['ivlFct']*100) f.maxIvl.setValue(c['maxIvl']) f.revplim.setText(self.parentLimText('rev')) + f.buryRev.setChecked(c.get("bury", True)) # lapse c = self.conf['lapse'] f.lapSteps.setText(self.listToUser(c['delays'])) @@ -270,6 +271,7 @@ class DeckConf(QDialog): c['ease4'] = f.easyBonus.value()/100.0 c['ivlFct'] = f.fi1.value()/100.0 c['maxIvl'] = f.maxIvl.value() + c['bury'] = f.buryRev.isChecked() # lapse c = self.conf['lapse'] self.updateList(c, 'delays', f.lapSteps, minSize=0) diff --git a/designer/dconf.ui b/designer/dconf.ui index 11d6b0160..2896abd80 100644 --- a/designer/dconf.ui +++ b/designer/dconf.ui @@ -271,13 +271,6 @@ - - - - - - - @@ -292,25 +285,6 @@ - - - - 0 - - - 0.000000000000000 - - - 999.000000000000000 - - - 1.000000000000000 - - - 100.000000000000000 - - - @@ -335,6 +309,39 @@ + + + + + + + + + + + 0 + + + 0.000000000000000 + + + 999.000000000000000 + + + 1.000000000000000 + + + 100.000000000000000 + + + + + + + Bury related reviews until the next day + + + @@ -616,6 +623,7 @@ easyBonus fi1 maxIvl + buryRev lapSteps lapMult lapMinInt