From e908aacedaf196ea559151658138052e587d12a6 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Mon, 27 Dec 2021 00:34:21 -0800 Subject: [PATCH] setup all-time stats --- suchwow/app.py | 2 +- suchwow/routes/leaderboard.py | 2 +- suchwow/templates/navbar.html | 1 + suchwow/templates/post/top.html | 2 ++ suchwow/utils/helpers.py | 3 ++- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/suchwow/app.py b/suchwow/app.py index 6cd3bb5..a234ebb 100644 --- a/suchwow/app.py +++ b/suchwow/app.py @@ -204,7 +204,7 @@ def load_cache(): app.logger.info('loading latest tipped into cache') get_latest_tipped_posts() app.logger.info('done') - for i in [1, 3, 7, 30]: + for i in [1, 3, 7, 30, 9999]: app.logger.info(f'loading top posts last {i} days into cache') get_top_posts(i) app.logger.info('done') diff --git a/suchwow/routes/leaderboard.py b/suchwow/routes/leaderboard.py index c36051e..3a17f81 100644 --- a/suchwow/routes/leaderboard.py +++ b/suchwow/routes/leaderboard.py @@ -23,7 +23,7 @@ def top_posts(): except: days = 1 - if days not in [1, 3, 7, 30]: + if days not in [1, 3, 7, 30, 9999]: days = 7 posts = get_top_posts(days) diff --git a/suchwow/templates/navbar.html b/suchwow/templates/navbar.html index f14602d..7c7be91 100755 --- a/suchwow/templates/navbar.html +++ b/suchwow/templates/navbar.html @@ -23,6 +23,7 @@ Top Memes Last 3 Days Top Memes Last Week Top Memes Last Month + Top Memes All Time About diff --git a/suchwow/templates/post/top.html b/suchwow/templates/post/top.html index 452956b..ff44783 100644 --- a/suchwow/templates/post/top.html +++ b/suchwow/templates/post/top.html @@ -10,6 +10,7 @@ {% if posts %} {% for row in posts | sort(attribute='received_wow', reverse=True) | batch(4) %}
+ {% if loop.index < 15 %} {% for post in row %}
@@ -37,6 +38,7 @@
{% endfor %} + {% endif %}
{% endfor %} {% else %} diff --git a/suchwow/utils/helpers.py b/suchwow/utils/helpers.py index f2b8796..0b91717 100644 --- a/suchwow/utils/helpers.py +++ b/suchwow/utils/helpers.py @@ -96,7 +96,8 @@ def get_top_posts(days=1): except: days = 1 - if days not in [1, 3, 7, 30]: + # stupid magic number bcuz fuck it + if days not in [1, 3, 7, 30, 9999]: days = 7 hours = 24 * days