aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-09-20 23:18:16 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-09-20 23:18:16 +0200
commit9f902d2485088c3dbf852a6fa0aaed580760ccb5 (patch)
tree0441886104246b11851ad7d3f4d468158987358e /src
parentReturn the most popular feeds for the last 30 days (before the date of the la... (diff)
downloadnewspipe-9f902d2485088c3dbf852a6fa0aaed580760ccb5.tar.gz
newspipe-9f902d2485088c3dbf852a6fa0aaed580760ccb5.tar.bz2
newspipe-9f902d2485088c3dbf852a6fa0aaed580760ccb5.zip
the number of days can be give in the url
Diffstat (limited to 'src')
-rw-r--r--src/web/views/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/web/views/views.py b/src/web/views/views.py
index 81ae081d..abebff15 100644
--- a/src/web/views/views.py
+++ b/src/web/views/views.py
@@ -48,15 +48,16 @@ def handle_sqlalchemy_assertion_error(error):
@etag_match
def popular():
"""
- Return the most popular feeds for the last 30 days.
+ Return the most popular feeds for the last nb_days days.
"""
+ nb_days = int(request.args.get('nb_days', 365))
last_added_feed = FeedController().read().\
order_by(desc('created_date')).limit(1)
if last_added_feed:
last_added_feed_date = last_added_feed.all()[0].created_date
else:
last_added_feed_date = datetime.now()
- not_before = last_added_feed_date - timedelta(days=30)
+ not_before = last_added_feed_date - timedelta(days=nb_days)
filters = {}
filters['created_date__gt'] = not_before
bgstack15