mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
report time studied at bottom of deck list
This commit is contained in:
parent
5e9f4f04a1
commit
3d227f27f2
1 changed files with 16 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.utils import askUser, getOnlyText, openLink, showWarning, showInfo, \
|
from aqt.utils import askUser, getOnlyText, openLink, showWarning, showInfo, \
|
||||||
shortcut
|
shortcut
|
||||||
from anki.utils import isMac, ids2str
|
from anki.utils import isMac, ids2str, fmtTimeSpan
|
||||||
import anki.js
|
import anki.js
|
||||||
from anki.errors import DeckRenameError
|
from anki.errors import DeckRenameError
|
||||||
import aqt
|
import aqt
|
||||||
|
@ -88,6 +88,9 @@ body { margin: 1em; -webkit-user-select: none; }
|
||||||
<table cellspacing=0 cellpading=3>
|
<table cellspacing=0 cellpading=3>
|
||||||
%(tree)s
|
%(tree)s
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
%(stats)s
|
||||||
</center>
|
</center>
|
||||||
<script>
|
<script>
|
||||||
$( init );
|
$( init );
|
||||||
|
@ -125,10 +128,21 @@ body { margin: 1em; -webkit-user-select: none; }
|
||||||
def _renderPage(self):
|
def _renderPage(self):
|
||||||
css = self.mw.sharedCSS + self._css
|
css = self.mw.sharedCSS + self._css
|
||||||
tree = self._renderDeckTree(self.mw.col.sched.deckDueTree())
|
tree = self._renderDeckTree(self.mw.col.sched.deckDueTree())
|
||||||
self.web.stdHtml(self._body%dict(tree=tree), css=css,
|
stats = self._renderStats()
|
||||||
|
self.web.stdHtml(self._body%dict(tree=tree, stats=stats), css=css,
|
||||||
js=anki.js.jquery+anki.js.ui)
|
js=anki.js.jquery+anki.js.ui)
|
||||||
self._drawButtons()
|
self._drawButtons()
|
||||||
|
|
||||||
|
def _renderStats(self):
|
||||||
|
cards, thetime = self.mw.col.db.first("""
|
||||||
|
select count(), sum(time)/1000 from revlog
|
||||||
|
where id > ?""", (self.mw.col.sched.dayCutoff-86400)*1000)
|
||||||
|
cards = cards or 0
|
||||||
|
thetime = thetime or 0
|
||||||
|
buf = _("Studied %(a)d cards in %(b)s today.") % dict(
|
||||||
|
a=cards, b=fmtTimeSpan(thetime))
|
||||||
|
return buf
|
||||||
|
|
||||||
def _renderDeckTree(self, nodes, depth=0):
|
def _renderDeckTree(self, nodes, depth=0):
|
||||||
if not nodes:
|
if not nodes:
|
||||||
return ""
|
return ""
|
||||||
|
|
Loading…
Reference in a new issue