diff options
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/templates/feed.html | 6 | ||||
-rw-r--r-- | pyaggr3g470r/views.py | 12 |
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 |