diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-12-30 11:12:53 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-12-30 11:12:53 +0100 |
commit | 193dbc7d1d75c6584fa9ff6d55570a5fa36c0112 (patch) | |
tree | ee93892d2285d058480671765673c578b8632074 /source | |
parent | Updated full and short version number in the Sphinx documentation. (diff) | |
download | newspipe-193dbc7d1d75c6584fa9ff6d55570a5fa36c0112.tar.gz newspipe-193dbc7d1d75c6584fa9ff6d55570a5fa36c0112.tar.bz2 newspipe-193dbc7d1d75c6584fa9ff6d55570a5fa36c0112.zip |
Minor improvements to the /feed page.
Diffstat (limited to 'source')
-rwxr-xr-x | source/pyAggr3g470r.py | 9 | ||||
-rw-r--r-- | source/templates/feed.html | 8 |
2 files changed, 10 insertions, 7 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 38f17c58..8652ec1a 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -266,7 +266,12 @@ class pyAggr3g470r(object): 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 - delta_today = datetime.datetime.fromordinal(datetime.date.today().toordinal()) - last_article + + last_post = articles[0]["article_date"] + today = datetime.datetime.now() + elapsed = today - last_post + + 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)) @@ -276,7 +281,7 @@ class pyAggr3g470r(object): return tmpl.render(feed=feed, articles=articles, favorites=favorites, \ nb_articles_feed=nb_articles_feed, nb_articles_total=nb_articles_total, nb_unread_articles_feed=nb_unread_articles_feed, \ first_post_date=first_article, end_post_date=last_article, \ - average=average, delta=delta, delta_today=delta_today, \ + average=average, delta=delta, elapsed=elapsed, \ tag_cloud=tag_cloud, word_size=word_size, mail_to=conf.mail_to) feed.exposed = True diff --git a/source/templates/feed.html b/source/templates/feed.html index 8d0871c1..2edda630 100644 --- a/source/templates/feed.html +++ b/source/templates/feed.html @@ -5,7 +5,7 @@ import utils %> <div class="left inner"> <p>The feed <b>${feed['feed_title']}</b> contains <b>${nb_articles_feed}</b> articles. - Representing ${(round(nb_articles_feed / nb_articles_total, 4)) * 100} percent of the total (${nb_articles_total}).</p> + Representing ${round((nb_articles_feed / nb_articles_total) * 100, 4)} percent of the total (${nb_articles_total}).</p> %if articles: <p>${(nb_unread_articles_feed == 0 and ["All articles are read"] or [str(nb_unread_articles_feed) + " unread article" + (nb_unread_articles_feed == 1 and [""] or ["s"])[0]])[0]}.</p> @@ -17,10 +17,8 @@ import utils %endif %if articles != []: - <p>The last article was posted ${delta_today.days} day(s) ago.</p> - %if delta_today.days > 0: - <p>Daily average: ${average}, between the ${first_post_date} and the ${end_post_date}.</p> - %endif + <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> <br /> |