aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-01-01 16:49:31 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-01-01 16:49:31 +0100
commitb4f26c158e654bdac0c055ad3d1d1fcbee2a931f (patch)
tree7c3ad85aafdf38689e03da201aba20583608248b /pyaggr3g470r
parentLink to the page to edit feed informations. (diff)
downloadnewspipe-b4f26c158e654bdac0c055ad3d1d1fcbee2a931f.tar.gz
newspipe-b4f26c158e654bdac0c055ad3d1d1fcbee2a931f.tar.bz2
newspipe-b4f26c158e654bdac0c055ad3d1d1fcbee2a931f.zip
Displaying more information in the /feed page.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/templates/feed.html6
-rw-r--r--pyaggr3g470r/views.py12
2 files changed, 16 insertions, 2 deletions
diff --git a/pyaggr3g470r/templates/feed.html b/pyaggr3g470r/templates/feed.html
index 7abd133f..b0f06eb6 100644
--- a/pyaggr3g470r/templates/feed.html
+++ b/pyaggr3g470r/templates/feed.html
@@ -8,8 +8,12 @@
<p>This feed contains {{ feed.articles|count }} <a href="/articles/{{ feed.oid }}">articles</a>.</p>
<p>Address of the feed: <a href="{{ feed.link }}">{{ feed.link }}</a>.</p>
<p>Address of the site: <a href="{{ feed.site_link }}">{{ feed.site_link }}</a>.</p>
+ <br />
+ <p>The last article was posted {{ elapsed.days }} day(s) ago.<br />
+ Daily average: {{ average }}, between the {{ first_post_date.strftime('%Y-%m-%d') }} and the {{ end_post_date.strftime('%Y-%m-%d') }}.</p>
+ <br />
<h3>Tag cloud</h3>
<div>{{ tag_cloud|safe }}</div>
</div>
</div><!-- /.container -->
-{% endblock %} \ No newline at end of file
+{% endblock %}
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index e80890af..af2abc7b 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -144,7 +144,17 @@ def feed(feed_id=None):
articles = feed.articles
top_words = utils.top_words(articles, n=50, size=int(word_size))
tag_cloud = utils.tag_cloud(top_words)
- return render_template('feed.html', head_title=feed.title, feed=feed, tag_cloud=tag_cloud)
+
+ today = datetime.datetime.now()
+ last_article = articles[0].date
+ first_article = articles[-1].date
+ delta = last_article - first_article
+ average = round(float(len(articles)) / abs(delta.days), 2)
+ elapsed = today - last_article
+
+ return render_template('feed.html', head_title=feed.title, feed=feed, tag_cloud=tag_cloud, \
+ first_post_date=first_article, end_post_date=last_article , \
+ average=average, delta=delta, elapsed=elapsed)
@app.route('/article/<article_id>', methods=['GET'])
@login_required
bgstack15