mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
fix webhook bug
This commit is contained in:
parent
47e25ab705
commit
54b93bf1dd
2 changed files with 16 additions and 13 deletions
|
@ -63,18 +63,17 @@ def get_todays_meal(session: Session, group: Union[int, GroupInDB]) -> Recipe:
|
|||
if isinstance(group, int):
|
||||
group: GroupInDB = db.groups.get(session, group)
|
||||
|
||||
if group.webhook_enable:
|
||||
today_slug = None
|
||||
today_slug = None
|
||||
|
||||
for mealplan in group.mealplans:
|
||||
mealplan: MealPlanInDB
|
||||
for meal in mealplan.meals:
|
||||
meal: MealOut
|
||||
if meal.date == date.today():
|
||||
today_slug = meal.slug
|
||||
break
|
||||
for mealplan in group.mealplans:
|
||||
mealplan: MealPlanInDB
|
||||
for meal in mealplan.meals:
|
||||
meal: MealOut
|
||||
if meal.date == date.today():
|
||||
today_slug = meal.slug
|
||||
break
|
||||
|
||||
if today_slug:
|
||||
return db.recipes.get(session, today_slug)
|
||||
else:
|
||||
return None
|
||||
if today_slug:
|
||||
return db.recipes.get(session, today_slug)
|
||||
else:
|
||||
return None
|
||||
|
|
|
@ -9,6 +9,10 @@ from sqlalchemy.orm.session import Session
|
|||
def post_webhooks(group: int, session: Session = None):
|
||||
session = session if session else create_session()
|
||||
group_settings: GroupInDB = db.groups.get(session, group)
|
||||
|
||||
if not group_settings.webhook_enable:
|
||||
return
|
||||
|
||||
todays_recipe = get_todays_meal(session, group)
|
||||
|
||||
if not todays_recipe:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue