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