aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/controllers/article.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r/controllers/article.py')
-rw-r--r--pyaggr3g470r/controllers/article.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/pyaggr3g470r/controllers/article.py b/pyaggr3g470r/controllers/article.py
index 46ca0988..0ec53a2f 100644
--- a/pyaggr3g470r/controllers/article.py
+++ b/pyaggr3g470r/controllers/article.py
@@ -1,3 +1,6 @@
+from sqlalchemy import func
+
+from bootstrap import db
import conf
from .abstract import AbstractController
from pyaggr3g470r.models import Article
@@ -25,3 +28,9 @@ class ArticleController(AbstractController):
if self.read(**id_).first():
continue
yield id_
+
+ def get_unread(self):
+ return dict(db.session.query(Article.feed_id, func.count(Article.id))
+ .filter(Article.readed == False,
+ Article.user_id == self.user_id)
+ .group_by(Article.feed_id).all())
bgstack15