From 0989ddf21a3f31f33ef40bc7f6fc88be61174835 Mon Sep 17 00:00:00 2001
From: cedricbonhomme
Date: Mon, 6 Jun 2011 21:30:45 +0200
Subject: Added more informations about a feed in the 'feed summary' page.
---
pyAggr3g470r.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index f928b089..fcbc058a 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -36,7 +36,7 @@ import threading
from collections import Counter
from BeautifulSoup import BeautifulSoup
-from datetime import date
+import datetime
import utils
import feedgetter
@@ -564,12 +564,14 @@ class Root:
html += """Stop receiving articles from this feed.
""" % \
(feed.feed_id, )
- first_article = utils.string_to_datetime(feed.articles.values()[0].article_date)
- last_article = utils.string_to_datetime(feed.articles.values()[-1].article_date)
- delta = first_article - last_article
- delta_today = date.today() - last_article
+ last_article = utils.string_to_datetime(feed.articles.values()[0].article_date)
+ first_article = utils.string_to_datetime(feed.articles.values()[-1].article_date)
+ delta = last_article - first_article
+ delta_today = datetime.datetime.fromordinal(datetime.date.today().toordinal()) - last_article
html += "The last article was posted " + str(abs(delta_today.days)) + " day(s) ago.
"
- html += "Daily average: " + str(abs(delta.days)/feed.nb_articles) + "
\n"
+ html += """Daily average: %s,""" % (str(abs(delta.days)/feed.nb_articles),)
+ html += """ between the %s and the %s.
\n""" % \
+ (feed.articles.values()[-1].article_date[:10], feed.articles.values()[0].article_date[:10])
html += "
Recent articles
"
for article in feed.articles.values()[:10]:
--
cgit