aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-27 22:09:28 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-27 22:09:28 +0200
commitd4eaa1d67465b55a7719b35db736e4fd3505541c (patch)
tree65e37c72b450634f9bc1842a11437d5cf0168d40 /pyaggr3g470r
parentUpdated anchor. (diff)
downloadnewspipe-d4eaa1d67465b55a7719b35db736e4fd3505541c.tar.gz
newspipe-d4eaa1d67465b55a7719b35db736e4fd3505541c.tar.bz2
newspipe-d4eaa1d67465b55a7719b35db736e4fd3505541c.zip
Testing a performance improvement.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/views.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 289764a3..eda9c399 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -213,18 +213,19 @@ def home():
The home page lists most recent articles of all feeds.
"""
#user = User.query.filter(User.email == g.user.email).first()
- result, unread = [], {}
+ result = []
for feed in g.user.feeds:
new_feed = Feed()
new_feed.id = feed.id
new_feed.title = feed.title
new_feed.enabled = feed.enabled
- new_feed.articles = Article.query.filter(Article.user_id == g.user.id,
- Article.feed_id == feed.id).order_by(desc("Article.date")).limit(9)
+ new_feed.articles = feed.articles[:9]
+ #new_feed.articles = Article.query.filter(Article.user_id == g.user.id,
+ #Article.feed_id == feed.id).order_by(desc("Article.date")).limit(9)
new_feed.nb_unread = Article.query.filter(Article.user_id == g.user.id, Article.feed_id == feed.id, Article.readed == False).count()
result.append(new_feed)
unread_articles = len(Article.query.filter(Article.user_id == g.user.id, Article.readed == False).all())
- return render_template('home.html', result=result, unread=unread, head_title=unread_articles)
+ return render_template('home.html', result=result, head_title=unread_articles)
@app.route('/fetch/', methods=['GET'])
@app.route('/fetch/<int:feed_id>', methods=['GET'])
bgstack15