From 3b3f188e1558987a8a14dc303912e208f77c7b60 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Fri, 31 Jul 2015 13:15:16 +0200 Subject: adding munin probes --- pyaggr3g470r/controllers/article.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pyaggr3g470r/controllers') diff --git a/pyaggr3g470r/controllers/article.py b/pyaggr3g470r/controllers/article.py index 70b9d2dd..21b4b5e7 100644 --- a/pyaggr3g470r/controllers/article.py +++ b/pyaggr3g470r/controllers/article.py @@ -33,6 +33,12 @@ class ArticleController(AbstractController): .filter(*self._to_filters(**filters)) .group_by(Article.feed_id).all()) + def count_by_user_id(self, **filters): + return dict(db.session.query(Article.user_id, + func.count(Article.id)) + .filter(*self._to_filters(**filters)) + .group_by(Article.user_id).all()) + def create(self, **attrs): # handling special denorm for article rights assert 'feed_id' in attrs -- cgit