fix reports app context

This commit is contained in:
Aaron Kimbre 2022-02-16 12:09:40 -06:00
parent 2e82f94b9d
commit b829d666c9

View File

@ -37,9 +37,10 @@ def uscore_by_date(date):
@scheduler.task("cron", id="gen_item_report", hour=23, timezone="UTC")
def gen_item_report():
with scheduler.app.app_context():
try:
current_app.logger.info("Start Item Report Generation")
with scheduler.app.app_context():
date = datetime.date.today().strftime('%Y-%m-%d')
report = Reports.query.filter(Reports.date==date).filter(Reports.report_type=="items").first()
@ -85,9 +86,10 @@ def gen_item_report():
@scheduler.task("cron", id="gen_currency_report", hour=23, timezone="UTC")
def gen_currency_report():
with scheduler.app.app_context():
try:
current_app.logger.info("Start Currency Report Generation")
with scheduler.app.app_context():
date = datetime.date.today().strftime('%Y-%m-%d')
report = Reports.query.filter(Reports.date==date).filter(Reports.report_type=="currency").first()
@ -127,9 +129,10 @@ def gen_currency_report():
@scheduler.task("cron", id="gen_uscore_report", hour=23, timezone="UTC")
def gen_uscore_report():
with scheduler.app.app_context():
try:
current_app.logger.info("Start U-Score Report Generation")
with scheduler.app.app_context():
date = datetime.date.today().strftime('%Y-%m-%d')
report = Reports.query.filter(Reports.date==date).filter(Reports.report_type=="uscore").first()