aboutsummaryrefslogtreecommitdiff
path: root/src/web/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/views')
-rw-r--r--src/web/views/views.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/web/views/views.py b/src/web/views/views.py
index a7c842d7..c3425a17 100644
--- a/src/web/views/views.py
+++ b/src/web/views/views.py
@@ -1,9 +1,11 @@
import logging
+from collections import Counter
from flask import (request, render_template, flash,
url_for, redirect, current_app)
from flask_babel import gettext
from conf import API_ROOT
+from web.controllers import FeedController
from web.lib.view_utils import etag_match
logger = logging.getLogger(__name__)
@@ -40,6 +42,17 @@ def handle_sqlalchemy_assertion_error(error):
return error.args[0], 400
+@current_app.route('/popular', methods=['GET'])
+@etag_match
+def popular():
+ feeds = FeedController().read().all()
+ counter = Counter()
+ for feed in feeds:
+ counter[feed.link] += 1
+ print(counter.most_common(50))
+ return render_template('popular.html', popular=counter.most_common(50))
+
+
@current_app.route('/about', methods=['GET'])
@etag_match
def about():
bgstack15