setup all-time stats

revamp
lza_menace 3 years ago
parent 226e7bbe15
commit e908aaceda

@ -204,7 +204,7 @@ def load_cache():
app.logger.info('loading latest tipped into cache') app.logger.info('loading latest tipped into cache')
get_latest_tipped_posts() get_latest_tipped_posts()
app.logger.info('done') 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') app.logger.info(f'loading top posts last {i} days into cache')
get_top_posts(i) get_top_posts(i)
app.logger.info('done') app.logger.info('done')

@ -23,7 +23,7 @@ def top_posts():
except: except:
days = 1 days = 1
if days not in [1, 3, 7, 30]: if days not in [1, 3, 7, 30, 9999]:
days = 7 days = 7
posts = get_top_posts(days) posts = get_top_posts(days)

@ -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=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=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=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>
</div> </div>
<a class="navbar-item" href="{{ url_for('about') }}">About</a> <a class="navbar-item" href="{{ url_for('about') }}">About</a>

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

@ -96,7 +96,8 @@ def get_top_posts(days=1):
except: except:
days = 1 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 days = 7
hours = 24 * days hours = 24 * days

Loading…
Cancel
Save