Fix Mensa cronjob

This commit is contained in:
2023-12-04 21:48:44 +01:00
parent dbcf3cc0ce
commit 6d26190fed

View File

@ -82,7 +82,7 @@ def formatDay(day: datetime):
return day return day
@scheduler.task('cron', id="refreshMeals", hour='*', day_of_week='*', minute='1-59', week='*', second='30') @scheduler.task('cron', id="refreshMeals", hour=8-11, day_of_week='*', minute='15', week='*', second='30')
def refreshMeals(): def refreshMeals():
print("Aktualisiere Essenspläne...\n") print("Aktualisiere Essenspläne...\n")
with scheduler.app.app_context(): with scheduler.app.app_context():
@ -100,7 +100,6 @@ def refreshMeals():
for m in dbmeals: for m in dbmeals:
dbnames += [m.name] dbnames += [m.name]
if set (dbnames) != set(apinames) and nomeal not in apinames: if set (dbnames) != set(apinames) and nomeal not in apinames:
print (dbnames, apinames)
for n in dbnames: for n in dbnames:
db.session.delete(Meals.query.filter_by(date=i, name=n).first()) db.session.delete(Meals.query.filter_by(date=i, name=n).first())
db.session.commit() db.session.commit()