aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2013-12-03 21:29:44 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2013-12-03 21:29:44 +0100
commit6de362b2dc3c29051e52f98b97b3ca14c5d6f353 (patch)
tree4a93f0f00e05130ea48db7febc3df8093855356e
parentThe title of the HTML page is now updated for /article and /feed pages. (diff)
downloadnewspipe-6de362b2dc3c29051e52f98b97b3ca14c5d6f353.tar.gz
newspipe-6de362b2dc3c29051e52f98b97b3ca14c5d6f353.tar.bz2
newspipe-6de362b2dc3c29051e52f98b97b3ca14c5d6f353.zip
Performance improvement: direct acces to articles in the database (without using the User object).
-rw-r--r--pyaggr3g470r/views.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index cf10d1c5..48e0e49d 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -279,8 +279,10 @@ def management():
form = AddFeedForm()
user = models.User.objects(email=g.user.email).first()
nb_feeds = len(user.feeds)
- nb_articles = sum([len(feed.articles) for feed in user.feeds])
- nb_unread_articles = sum([len([article for article in feed.articles if not article.readed]) for feed in user.feeds])
+ #nb_articles = sum([len(feed.articles) for feed in user.feeds])
+ #nb_unread_articles = sum([len([article for article in feed.articles if not article.readed]) for feed in user.feeds])
+ nb_articles = len(models.Article.objects())
+ nb_unread_articles = len(models.Article.objects(readed=False))
return render_template('management.html', form=form, \
nb_feeds=nb_feeds, nb_articles=nb_articles, nb_unread_articles=nb_unread_articles)
bgstack15