mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-09 19:58:19 +00:00
Merge branch 'main' into character-rescue
This commit is contained in:
commit
04f4e833a4
@ -268,9 +268,13 @@ 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):
|
if desc in ("", None):
|
||||||
desc = None
|
desc = None
|
||||||
|
else:
|
||||||
|
desc = desc[0]
|
||||||
|
if desc in ("", None):
|
||||||
|
desc = None
|
||||||
if desc:
|
if desc:
|
||||||
desc = desc.replace('"', "“")
|
desc = desc.replace('"', "“")
|
||||||
return desc
|
return 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():
|
||||||
try:
|
with scheduler.app.app_context():
|
||||||
current_app.logger.info("Start Item Report Generation")
|
try:
|
||||||
with scheduler.app.app_context():
|
current_app.logger.info("Start Item Report Generation")
|
||||||
|
|
||||||
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,
|
||||||
@ -77,23 +79,25 @@ def gen_item_report():
|
|||||||
)
|
)
|
||||||
|
|
||||||
new_report.save()
|
new_report.save()
|
||||||
current_app.logger.info(f"Generated Item Report for {date}")
|
current_app.logger.info(f"Generated Item Report for {date}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.critical(f"REPORT::ITEMS - {e}")
|
current_app.logger.critical(f"REPORT::ITEMS - {e}")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@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():
|
||||||
try:
|
with scheduler.app.app_context():
|
||||||
current_app.logger.info("Start Currency Report Generation")
|
try:
|
||||||
with scheduler.app.app_context():
|
current_app.logger.info("Start Currency Report Generation")
|
||||||
|
|
||||||
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,
|
||||||
@ -119,23 +123,25 @@ def gen_currency_report():
|
|||||||
)
|
)
|
||||||
|
|
||||||
new_report.save()
|
new_report.save()
|
||||||
current_app.logger.info(f"Generated Currency Report for {date}")
|
current_app.logger.info(f"Generated Currency Report for {date}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.critical(f"REPORT::CURRENCY - {e}")
|
current_app.logger.critical(f"REPORT::CURRENCY - {e}")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@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():
|
||||||
try:
|
with scheduler.app.app_context():
|
||||||
current_app.logger.info("Start U-Score Report Generation")
|
try:
|
||||||
with scheduler.app.app_context():
|
current_app.logger.info("Start U-Score Report Generation")
|
||||||
|
|
||||||
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,
|
||||||
@ -161,7 +167,7 @@ def gen_uscore_report():
|
|||||||
)
|
)
|
||||||
|
|
||||||
new_report.save()
|
new_report.save()
|
||||||
current_app.logger.info(f"Generated U-Score Report for {date}")
|
current_app.logger.info(f"Generated U-Score Report for {date}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.critical(f"REPORT::U-SCORE - {e}")
|
current_app.logger.critical(f"REPORT::U-SCORE - {e}")
|
||||||
return
|
return
|
||||||
|
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