From f1a2fc7feb63952cc0a88b4f98b2f20c25f7545e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 13 Dec 2008 15:25:43 +0900 Subject: [PATCH] new failed card eta from nick cook --- anki/deck.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/anki/deck.py b/anki/deck.py index 028bb3c99..c1913720b 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -736,18 +736,26 @@ and due < :now""", now=time.time()) stats['failed'] = self.failedSoonCount stats['rev'] = self.revCount if stats['dAverageTime']: - if self.newCardSpacing == NEW_CARDS_DISTRIBUTE: - count = stats['rev'] + stats['new'] - elif self.newCardSpacing == NEW_CARDS_LAST: - count = stats['rev'] or stats['new'] - count += stats['failed'] - count *= 1 + stats['gYoungNo%'] / 100.0 stats['timeLeft'] = anki.utils.fmtTimeSpan( - stats['dAverageTime'] * count, pad=0, point=1, short=short) + self.getETA(stats), pad=0, point=1, short=short) else: stats['timeLeft'] = _("Unknown") return stats + def getETA(self, stats): + # rev + new cards first, account for failures + count = stats['rev'] + stats['new'] + count *= 1 + stats['gYoungNo%'] / 100.0 + left = count * stats['dAverageTime'] + # failed - higher time per card for higher amount of cards + failedBaseMulti = 1.5 + failedMod = 0.07 + failedBaseCount = 20 + factor = (failedBaseMulti + + (failedMod * (stats['failed'] - failedBaseCount))) + left += stats['failed'] * stats['dAverageTime'] * factor + return left + def queueForCard(self, card): "Return the queue the current card is in." if self.cardIsNew(card):