Fix offline sync priority, idempotent check state, and add loading spinner for meal plan import
This commit is contained in:
@@ -1182,6 +1182,18 @@ def toggle_shopping_item(item_id: int) -> Optional[Dict[str, Any]]:
|
||||
return row
|
||||
|
||||
|
||||
def set_shopping_item_checked(item_id: int, checked: bool) -> Optional[Dict[str, Any]]:
|
||||
"""Setzt den Erledigt-Status eines Eintrags explizit auf True oder False."""
|
||||
val = 1 if checked else 0
|
||||
query = "UPDATE shopping_list SET checked = ? WHERE id = ?"
|
||||
execute_query(query, (val, item_id), fetch="none", commit=True)
|
||||
row = execute_query("SELECT * FROM shopping_list WHERE id = ?", (item_id,), fetch="one")
|
||||
if row:
|
||||
row["checked"] = bool(row.get("checked"))
|
||||
row["display_source"] = clean_source_label(row.get("source", ""))
|
||||
return row
|
||||
|
||||
|
||||
def delete_shopping_item(item_id: int) -> bool:
|
||||
"""Löscht einen einzelnen Eintrag aus der Einkaufsliste."""
|
||||
query = "DELETE FROM shopping_list WHERE id = ?"
|
||||
|
||||
Reference in New Issue
Block a user