From b138c9edd5fa0158bbe3b5c30fe82e3c77408f12 Mon Sep 17 00:00:00 2001 From: Jonathan Rehm Date: Thu, 6 Jul 2017 22:33:57 -0700 Subject: [PATCH] Show read/unread counts --- cps/web.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index c810ee7f..6be3c448 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1632,7 +1632,11 @@ def render_read_books(page, are_read, as_xml=False): response.headers["Content-Type"] = "application/xml" return response else: - name = u'Read Books' if are_read else u'Unread Books' + if are_read: + name = u'Read Books' + ' (' + str(len(readBookIds)) + ')' + else: + total_books = db.session.query(func.count(db.Books.id)).scalar() + name = u'Unread Books' + ' (' + str(total_books - len(readBookIds)) + ')' return render_title_template('index.html', random=random, entries=entries, pagination=pagination, title=_(name, name=name))