mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-26 07:27:19 +00:00
Merge branch 'main' into character-rescue
This commit is contained in:
commit
04f4e833a4
@ -268,7 +268,11 @@ def register_luclient_jinja_helpers(app):
|
|||||||
'select description from Objects where id = ?',
|
'select description from Objects where id = ?',
|
||||||
[lot_id],
|
[lot_id],
|
||||||
one=True
|
one=True
|
||||||
)[0]
|
)
|
||||||
|
if desc in ("", None):
|
||||||
|
desc = None
|
||||||
|
else:
|
||||||
|
desc = desc[0]
|
||||||
if desc in ("", None):
|
if desc in ("", None):
|
||||||
desc = None
|
desc = None
|
||||||
if desc:
|
if desc:
|
||||||
|
@ -37,15 +37,17 @@ def uscore_by_date(date):
|
|||||||
|
|
||||||
@scheduler.task("cron", id="gen_item_report", hour=23, timezone="UTC")
|
@scheduler.task("cron", id="gen_item_report", hour=23, timezone="UTC")
|
||||||
def gen_item_report():
|
def gen_item_report():
|
||||||
|
with scheduler.app.app_context():
|
||||||
try:
|
try:
|
||||||
current_app.logger.info("Start Item Report Generation")
|
current_app.logger.info("Start Item Report Generation")
|
||||||
with scheduler.app.app_context():
|
|
||||||
date = datetime.date.today().strftime('%Y-%m-%d')
|
date = datetime.date.today().strftime('%Y-%m-%d')
|
||||||
report = Reports.query.filter(Reports.date==date).filter(Reports.report_type=="items").first()
|
report = Reports.query.filter(Reports.date==date).filter(Reports.report_type=="items").first()
|
||||||
|
|
||||||
# Only one report per day
|
# Only one report per day
|
||||||
if report != None:
|
if report != None:
|
||||||
current_app.logger.info(f"Item Report Already Generated for {date}")
|
current_app.logger.info(f"Item Report Already Generated for {date}")
|
||||||
|
return
|
||||||
|
|
||||||
char_xmls = CharacterXML.query.join(
|
char_xmls = CharacterXML.query.join(
|
||||||
CharacterInfo,
|
CharacterInfo,
|
||||||
@ -85,15 +87,17 @@ def gen_item_report():
|
|||||||
|
|
||||||
@scheduler.task("cron", id="gen_currency_report", hour=23, timezone="UTC")
|
@scheduler.task("cron", id="gen_currency_report", hour=23, timezone="UTC")
|
||||||
def gen_currency_report():
|
def gen_currency_report():
|
||||||
|
with scheduler.app.app_context():
|
||||||
try:
|
try:
|
||||||
current_app.logger.info("Start Currency Report Generation")
|
current_app.logger.info("Start Currency Report Generation")
|
||||||
with scheduler.app.app_context():
|
|
||||||
date = datetime.date.today().strftime('%Y-%m-%d')
|
date = datetime.date.today().strftime('%Y-%m-%d')
|
||||||
report = Reports.query.filter(Reports.date==date).filter(Reports.report_type=="currency").first()
|
report = Reports.query.filter(Reports.date==date).filter(Reports.report_type=="currency").first()
|
||||||
|
|
||||||
# Only one report per day
|
# Only one report per day
|
||||||
if report != None:
|
if report != None:
|
||||||
current_app.logger.info(f"Currency Report Already Generated for {date}")
|
current_app.logger.info(f"Currency Report Already Generated for {date}")
|
||||||
|
return
|
||||||
|
|
||||||
characters = CharacterXML.query.join(
|
characters = CharacterXML.query.join(
|
||||||
CharacterInfo,
|
CharacterInfo,
|
||||||
@ -127,15 +131,17 @@ def gen_currency_report():
|
|||||||
|
|
||||||
@scheduler.task("cron", id="gen_uscore_report", hour=23, timezone="UTC")
|
@scheduler.task("cron", id="gen_uscore_report", hour=23, timezone="UTC")
|
||||||
def gen_uscore_report():
|
def gen_uscore_report():
|
||||||
|
with scheduler.app.app_context():
|
||||||
try:
|
try:
|
||||||
current_app.logger.info("Start U-Score Report Generation")
|
current_app.logger.info("Start U-Score Report Generation")
|
||||||
with scheduler.app.app_context():
|
|
||||||
date = datetime.date.today().strftime('%Y-%m-%d')
|
date = datetime.date.today().strftime('%Y-%m-%d')
|
||||||
report = Reports.query.filter(Reports.date==date).filter(Reports.report_type=="uscore").first()
|
report = Reports.query.filter(Reports.date==date).filter(Reports.report_type=="uscore").first()
|
||||||
|
|
||||||
# Only one report per day
|
# Only one report per day
|
||||||
if report != None:
|
if report != None:
|
||||||
current_app.logger.info(f"U-Score Report Already Generated for {date}")
|
current_app.logger.info(f"U-Score Report Already Generated for {date}")
|
||||||
|
return
|
||||||
|
|
||||||
characters = CharacterXML.query.join(
|
characters = CharacterXML.query.join(
|
||||||
CharacterInfo,
|
CharacterInfo,
|
||||||
|
11
wsgi.py
11
wsgi.py
@ -13,4 +13,13 @@ def make_shell_context():
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
app.run(host='0.0.0.0')
|
app.run(host='0.0.0.0')
|
||||||
|
else:
|
||||||
|
import logging
|
||||||
|
from logging.handlers import RotatingFileHandler
|
||||||
|
gunicorn_logger = logging.getLogger('gunicorn.error')
|
||||||
|
app.logger.handlers = gunicorn_logger.handlers
|
||||||
|
file_handler = RotatingFileHandler('nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20)
|
||||||
|
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||||
|
file_handler.setFormatter(formatter)
|
||||||
|
app.logger.addHandler(file_handler)
|
||||||
|
app.logger.setLevel(gunicorn_logger.level)
|
||||||
|
Loading…
Reference in New Issue
Block a user