aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2014-02-04 14:44:41 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2014-02-04 14:44:41 +0100
commit895ed96f77a4526410722c90f455cd0cde62a606 (patch)
tree9868cb79fe2d0108b382278fe69deac99e56d83d /pyaggr3g470r
parentMinor fix to the templates for the views /edit_feed and /profile. (diff)
downloadnewspipe-895ed96f77a4526410722c90f455cd0cde62a606.tar.gz
newspipe-895ed96f77a4526410722c90f455cd0cde62a606.tar.bz2
newspipe-895ed96f77a4526410722c90f455cd0cde62a606.zip
Give an idea of the importance of a feed compared to the whole database.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/templates/feed.html3
-rw-r--r--pyaggr3g470r/views.py3
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 @@
</div>
<div class="jumbotron">
<p>
- This feed contains {{ feed.articles|count }} <a href="/articles/{{ feed.oid }}">articles</a>.<br />
+ This feed contains {{ feed.articles|count }} <a href="/articles/{{ feed.oid }}">articles</a>
+ ({{ ((feed.articles|count * 100 ) / nb_articles) | round(2, 'floor') }}% of the database).<br />
Address of the feed: <a href="{{ feed.link }}">{{ feed.link }}</a>.<br />
Address of the site: <a href="{{ feed.site_link }}">{{ feed.site_link }}</a>.<br />
{% 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/<article_id>', methods=['GET'])
bgstack15