From d8a9a5ea1fa1ed3a00b2baeadb47fe05ebd3d721 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 12 Mar 2012 14:04:22 +0900 Subject: [PATCH] card.timeLimit() --- anki/cards.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/anki/cards.py b/anki/cards.py index d4abf8fee..153b7d7ab 100644 --- a/anki/cards.py +++ b/anki/cards.py @@ -134,8 +134,12 @@ lapses=?, left=?, odue=?, did=? where id = ?""", def startTimer(self): self.timerStarted = time.time() + def timeLimit(self): + "Time limit for answering in milliseconds." + conf = self.col.decks.confForDid(self.odid or self.did) + return conf['maxTaken']*1000 + def timeTaken(self): "Time taken to answer card, in integer MS." total = int((time.time() - self.timerStarted)*1000) - conf = self.col.decks.confForDid(self.odid or self.did) - return min(total, conf['maxTaken']*1000) + return min(total, self.timeLimit())