Keep a day's food when it's marked no lunch
This commit is contained in:
1 parent
42d5be9dfb
commit
98ef76bc1e
1 file changed
+3
-2
@@ -476,8 +476,9 @@ class MenuItemIn(BaseModel):
|
||||
|
||||
@app.patch("/api/menu_items/{item_id}")
|
||||
def edit_menu_item(item_id: int, body: MenuItemIn, conn: DB):
|
||||
"""Fix a misread menu day, in review or later."""
|
||||
items = [] if body.no_lunch else [i.strip() for i in body.items if i.strip()]
|
||||
"""Fix a misread menu day, in review or after publishing: menus never reach a calendar file, so the
|
||||
lunch screen shows the change right away. The food is kept when no_lunch is set, so unticking it brings it back."""
|
||||
items = [i.strip() for i in body.items if i.strip()]
|
||||
with conn:
|
||||
found(conn.execute("UPDATE menu_item SET items = ?, no_lunch = ?, flags = '[]' WHERE id = ? RETURNING id",
|
||||
(json.dumps(items), body.no_lunch, item_id)).fetchone(), "menu item")
|
||||
|
||||
Reference in new issue
Block a user