aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rwxr-xr-xsource/pyAggr3g470r.py15
-rw-r--r--source/templates/feed.html2
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 />
bgstack15