From 895ed96f77a4526410722c90f455cd0cde62a606 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Tue, 4 Feb 2014 14:44:41 +0100 Subject: Give an idea of the importance of a feed compared to the whole database. --- pyaggr3g470r/templates/feed.html | 3 ++- pyaggr3g470r/views.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyaggr3g470r/templates/feed.html b/pyaggr3g470r/templates/feed.html index 1ad27947..93b67bd4 100644 --- a/pyaggr3g470r/templates/feed.html +++ b/pyaggr3g470r/templates/feed.html @@ -9,7 +9,8 @@

- This feed contains {{ feed.articles|count }} articles.
+ This feed contains {{ feed.articles|count }} articles + ({{ ((feed.articles|count * 100 ) / nb_articles) | round(2, 'floor') }}% of the database).
Address of the feed: {{ feed.link }}.
Address of the site: {{ feed.site_link }}.
{% if feed.articles|count != 0 %} diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index 80dd203c..f77b49e2 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -144,6 +144,7 @@ def feed(feed_id=None): Presents detailed information about a feed. """ word_size = 6 + nb_articles = models.Article.objects().count() user = models.User.objects(email=g.user.email, feeds__oid=feed_id).first() for feed in user.feeds: if str(feed.oid) == feed_id: @@ -165,7 +166,7 @@ def feed(feed_id=None): elapsed = today - last_article return render_template('feed.html', head_title=utils.clear_string(feed.title), feed=feed, tag_cloud=tag_cloud, \ - first_post_date=first_article, end_post_date=last_article , \ + first_post_date=first_article, end_post_date=last_article , nb_articles=nb_articles, \ average=average, delta=delta, elapsed=elapsed) @app.route('/article/', methods=['GET']) -- cgit