diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-12-30 11:21:28 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-12-30 11:21:28 +0100 |
commit | 4c1dc33a806920b46f5a05e244cfb7900aa8f08b (patch) | |
tree | f3aa865a87dafef15065d6ef7b2ada1fcde6564d | |
parent | Minor improvements to the /feed page. (diff) | |
download | newspipe-4c1dc33a806920b46f5a05e244cfb7900aa8f08b.tar.gz newspipe-4c1dc33a806920b46f5a05e244cfb7900aa8f08b.tar.bz2 newspipe-4c1dc33a806920b46f5a05e244cfb7900aa8f08b.zip |
Minor improvements to the /feed page.
-rwxr-xr-x | source/pyAggr3g470r.py | 15 | ||||
-rw-r--r-- | source/templates/feed.html | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 8652ec1a..f228781d 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -259,21 +259,18 @@ class pyAggr3g470r(object): nb_articles_feed = self.mongo.nb_articles(feed_id) nb_articles_total = self.mongo.nb_articles() nb_unread_articles_feed = self.mongo.nb_unread_articles(feed_id) + favorites = self.mongo.get_favorites(feed_id) except KeyError: return self.error("This feed do not exists.") if articles != []: - last_article = utils.string_to_datetime(str(articles[0]["article_date"])) - first_article = utils.string_to_datetime(str(articles[self.mongo.nb_articles(feed_id)-2]["article_date"])) - delta = last_article - first_article - - last_post = articles[0]["article_date"] today = datetime.datetime.now() - elapsed = today - last_post - + last_article = articles[0]["article_date"] + first_article = articles[self.mongo.nb_articles(feed_id)-2]["article_date"] + delta = last_article - first_article + elapsed = today - last_article + average = round(nb_articles_feed / abs(delta.days), 2) - average = round(float(nb_articles_feed) / abs(delta.days), 2) - favorites = self.mongo.get_favorites(feed_id) top_words = utils.top_words(articles = self.mongo.get_articles(feed_id), n=50, size=int(word_size)) tag_cloud = utils.tag_cloud(top_words) diff --git a/source/templates/feed.html b/source/templates/feed.html index 2edda630..01799fb7 100644 --- a/source/templates/feed.html +++ b/source/templates/feed.html @@ -18,7 +18,7 @@ import utils %if articles != []: <p>The last article was posted ${elapsed.days} day(s) ago.</p> - <p>Daily average: ${average}, between the ${first_post_date} and the ${end_post_date}.</p> + <p>Daily average: ${average}, between the ${first_post_date.strftime('%Y-%m-%d')} and the ${end_post_date.strftime('%Y-%m-%d')}.</p> <br /> |