remove unnecessary stuff
parent
d22bbadccc
commit
042cc41fa4
|
@ -13,8 +13,7 @@ import click
|
|||
import requests
|
||||
import ffmpeg
|
||||
|
||||
import files.helpers.stats as stats
|
||||
import files.routes.static as route_static
|
||||
from files.helpers.stats import *
|
||||
from files.routes.front import frontlist
|
||||
from files.__main__ import cache
|
||||
from files.classes import *
|
||||
|
@ -88,10 +87,11 @@ def cron_fn(every_5m, every_1d, every_1mo):
|
|||
_hole_inactive_purge_task()
|
||||
g.db.commit()
|
||||
|
||||
stats.generate_charts_task(SITE)
|
||||
chart(kind='daily')
|
||||
chart(kind='weekly')
|
||||
g.db.commit()
|
||||
|
||||
cache.set('stats', stats.stats(), timeout=CRON_CACHE_TIMEOUT)
|
||||
cache.set('stats', stats(), timeout=CRON_CACHE_TIMEOUT)
|
||||
g.db.commit()
|
||||
|
||||
_leaderboard_task()
|
||||
|
|
|
@ -12,11 +12,7 @@ from files.classes.emoji import *
|
|||
from files.classes.award import AwardRelationship
|
||||
from files.helpers.config.const import *
|
||||
|
||||
def generate_charts_task(site):
|
||||
chart(kind='daily', site=site)
|
||||
chart(kind='weekly', site=site)
|
||||
|
||||
def chart(kind, site):
|
||||
def chart(kind):
|
||||
now = time.gmtime()
|
||||
midnight_this_morning = time.struct_time((
|
||||
now.tm_year, now.tm_mon, now.tm_mday,
|
||||
|
@ -75,7 +71,7 @@ def chart(kind, site):
|
|||
posts_chart.set_xlabel("Posts", labelpad=10.0, size=30)
|
||||
comments_chart.set_xlabel("Comments", labelpad=10.0, size=30)
|
||||
|
||||
file = f'/{site}_{kind}.png'
|
||||
file = f'/images/{kind}_chart.png'
|
||||
|
||||
plt.savefig(file, bbox_inches='tight')
|
||||
plt.clf()
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
{% set today = datetime.datetime.today().strftime('%Y-%m-%d') %}
|
||||
|
||||
<h3>Weekly Chart</h3>
|
||||
<a href="{{SITE_FULL_IMAGES}}/weekly_chart.png?x={{today}}" rel="noopener" target="_blank">
|
||||
<img alt="Weekly Chart" class="img" src="{{SITE_FULL_IMAGES}}/weekly_chart.png?x={{today}}">
|
||||
<a href="{{SITE_FULL_IMAGES}}/images/weekly_chart.png?x={{today}}" rel="noopener" target="_blank">
|
||||
<img alt="Weekly Chart" class="img" src="{{SITE_FULL_IMAGES}}/images/weekly_chart.png?x={{today}}">
|
||||
</a>
|
||||
|
||||
<h3>Daily Chart</h3>
|
||||
<a href="{{SITE_FULL_IMAGES}}/daily_chart.png?x={{today}}" rel="noopener" target="_blank">
|
||||
<img alt="Daily Chart" class="img" src="{{SITE_FULL_IMAGES}}/daily_chart.png?x={{today}}">
|
||||
<a href="{{SITE_FULL_IMAGES}}/images/daily_chart.png?x={{today}}" rel="noopener" target="_blank">
|
||||
<img alt="Daily Chart" class="img" src="{{SITE_FULL_IMAGES}}/images/daily_chart.png?x={{today}}">
|
||||
</a>
|
||||
</header>
|
||||
|
||||
|
|
Loading…
Reference in New Issue