setup all-time stats

This commit is contained in:
lza_menace 2021-12-27 00:34:21 -08:00
parent 226e7bbe15
commit e908aaceda
5 changed files with 7 additions and 3 deletions

View file

@ -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')

View file

@ -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)

View file

@ -23,6 +23,7 @@
<a class="navbar-item" href="{{ url_for('leaderboard.top_posts') }}?days=3">Top Memes Last 3 Days</a>
<a class="navbar-item" href="{{ url_for('leaderboard.top_posts') }}?days=7">Top Memes Last Week</a>
<a class="navbar-item" href="{{ url_for('leaderboard.top_posts') }}?days=30">Top Memes Last Month</a>
<a class="navbar-item" href="{{ url_for('leaderboard.top_posts') }}?days=9999">Top Memes All Time</a>
</div>
</div>
<a class="navbar-item" href="{{ url_for('about') }}">About</a>

View file

@ -10,6 +10,7 @@
{% if posts %}
{% for row in posts | sort(attribute='received_wow', reverse=True) | batch(4) %}
<div class="columns">
{% if loop.index < 15 %}
{% for post in row %}
<div class="column">
<div class="card">
@ -37,6 +38,7 @@
</div>
</div>
{% endfor %}
{% endif %}
</div>
{% endfor %}
{% else %}

View file

@ -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