track full card time, not just question. use failed cnt for average

This commit is contained in:
Damien Elmes 2008-09-29 14:15:46 +09:00
parent b43bba1d46
commit 35fc4fbd3f
3 changed files with 6 additions and 4 deletions

View file

@ -99,9 +99,11 @@ class Card(object):
self.timerStopped = time.time() self.timerStopped = time.time()
def thinkingTime(self): def thinkingTime(self):
"Return the time this card's been shown."
return (self.timerStopped or time.time()) - self.timerStarted return (self.timerStopped or time.time()) - self.timerStarted
def totalTime(self):
return time.time() - self.timerStarted
def css(self): def css(self):
return self.cardModel.css() + self.fact.css() return self.cardModel.css() + self.fact.css()
@ -115,7 +117,7 @@ class Card(object):
self.successive += 1 self.successive += 1
else: else:
self.successive = 0 self.successive = 0
delay = self.thinkingTime() delay = self.totalTime()
# ignore any times over 60 seconds # ignore any times over 60 seconds
if delay < 60: if delay < 60:
self.reviewTime += delay self.reviewTime += delay

View file

@ -690,12 +690,12 @@ priority != 0 and due < :now and spaceUntil > :now""",
stats['new'] = self.newCountLeftToday stats['new'] = self.newCountLeftToday
stats['failed'] = self.failedCount stats['failed'] = self.failedCount
stats['successive'] = self.reviewCount stats['successive'] = self.reviewCount
#stats['old'] = stats['failed'] + stats['successive']
if stats['dAverageTime']: if stats['dAverageTime']:
if self.newCardSpacing == NEW_CARDS_DISTRIBUTE: if self.newCardSpacing == NEW_CARDS_DISTRIBUTE:
count = stats['successive'] + stats['new'] count = stats['successive'] + stats['new']
elif self.newCardSpacing == NEW_CARDS_LAST: elif self.newCardSpacing == NEW_CARDS_LAST:
count = stats['successive'] or stats['new'] count = stats['successive'] or stats['new']
count += stats['failed']
stats['timeLeft'] = anki.utils.fmtTimeSpan( stats['timeLeft'] = anki.utils.fmtTimeSpan(
stats['dAverageTime'] * count, pad=0, point=1) stats['dAverageTime'] * count, pad=0, point=1)
else: else:

View file

@ -146,7 +146,7 @@ def updateAllStats(s, gs, ds, card, ease, oldState):
def updateStats(s, stats, card, ease, oldState): def updateStats(s, stats, card, ease, oldState):
stats.reps += 1 stats.reps += 1
delay = card.thinkingTime() delay = card.totalTime()
if delay >= 60: if delay >= 60:
# make a guess as to the time spent answering # make a guess as to the time spent answering
stats.reviewTime += stats.averageTime stats.reviewTime += stats.averageTime