aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/controllers
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-05-24 19:09:35 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2015-07-02 15:34:16 +0200
commit4f03d7b324360f718780fcbdfc359f60896fead4 (patch)
tree772ead2931ebd12dfff3eb2199d13463ae3e1fc3 /pyaggr3g470r/controllers
parentadding comments and tests (diff)
downloadnewspipe-4f03d7b324360f718780fcbdfc359f60896fead4.tar.gz
newspipe-4f03d7b324360f718780fcbdfc359f60896fead4.tar.bz2
newspipe-4f03d7b324360f718780fcbdfc359f60896fead4.zip
accelerating the feeds page
Diffstat (limited to 'pyaggr3g470r/controllers')
-rw-r--r--pyaggr3g470r/controllers/article.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/pyaggr3g470r/controllers/article.py b/pyaggr3g470r/controllers/article.py
index b3a79838..70b9d2dd 100644
--- a/pyaggr3g470r/controllers/article.py
+++ b/pyaggr3g470r/controllers/article.py
@@ -26,11 +26,12 @@ class ArticleController(AbstractController):
continue
yield id_
- def get_unread(self):
+ def count_by_feed(self, **filters):
+ if self.user_id:
+ filters['user_id'] = self.user_id
return dict(db.session.query(Article.feed_id, func.count(Article.id))
- .filter(*self._to_filters(readed=False,
- user_id=self.user_id))
- .group_by(Article.feed_id).all())
+ .filter(*self._to_filters(**filters))
+ .group_by(Article.feed_id).all())
def create(self, **attrs):
# handling special denorm for article rights
bgstack15