aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-11-18 07:42:20 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-11-18 07:42:20 +0100
commit4190c870e97939f41db8e36521350d6bcdb87fbe (patch)
tree3abfd2e28802f31d6401ebbff308a5c565e84a86
parentAdded inactives.html template. (diff)
downloadnewspipe-4190c870e97939f41db8e36521350d6bcdb87fbe.tar.gz
newspipe-4190c870e97939f41db8e36521350d6bcdb87fbe.tar.bz2
newspipe-4190c870e97939f41db8e36521350d6bcdb87fbe.zip
Sort articles for the page /inactives.
-rw-r--r--pyaggr3g470r/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 62f5ae5e..87a0cec4 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -215,7 +215,8 @@ def inactives():
today = datetime.datetime.now()
inactives = []
for feed in user.feeds:
- last_post = feed.articles[0].date
+ last_post = sorted(feed.articles, key=lambda t: t.date,
+reverse=True)[0].date
elapsed = today - last_post
if elapsed > datetime.timedelta(days=nb_days):
inactives.append((feed, elapsed))
@@ -309,4 +310,4 @@ def delete_feed(feed_id=None):
# delete the feed (EmbeddedDocument object)
user.feeds.remove(feed)
user.save()
- return redirect(url_for('home')) \ No newline at end of file
+ return redirect(url_for('home'))
bgstack15