Fix offline sync priority, idempotent check state, and add loading spinner for meal plan import

This commit is contained in:
2026-10-15 22:29:12 +02:00
parent 9665e245c2
commit 0196c6d9e2
3 changed files with 130 additions and 38 deletions
+12
View File
@@ -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 = ?"