Remove request when meal purchased
This commit is contained in:
parent
410b097d5c
commit
54f0dcbbb9
1 changed files with 2 additions and 8 deletions
|
|
@ -151,13 +151,7 @@ async def update_purchased_meals(conn, meal_ids: List[int]) -> None:
|
|||
remaining_ingredients = ingredients - purchased_ingredient_ids
|
||||
if not remaining_ingredients:
|
||||
await mark_purchased(conn, meal)
|
||||
|
||||
# If all ingredients are purchased, update the meal status
|
||||
await conn.execute('''
|
||||
UPDATE Meal
|
||||
SET purchase_date = ?
|
||||
WHERE id = ?
|
||||
''', (datetime.now().isoformat(), meal.id))
|
||||
await remove_request(conn, None, meal=meal)
|
||||
|
||||
async def is_requested(conn, meal: Meal) -> bool:
|
||||
if meal.id < 0:
|
||||
|
|
@ -198,7 +192,7 @@ async def request(conn, person: Person, ingredient: Optional[Ingredient] = None,
|
|||
|
||||
return item
|
||||
|
||||
async def remove_request(conn, person: Person, meal: Optional[Meal] = None, ingredient: Optional[Ingredient] = None) -> bool:
|
||||
async def remove_request(conn, person: Person = None, meal: Optional[Meal] = None, ingredient: Optional[Ingredient] = None) -> bool:
|
||||
if meal is not None:
|
||||
async with conn.execute('''
|
||||
DELETE FROM ShoppingListItem
|
||||
|
|
|
|||
Loading…
Reference in a new issue