From 9517225d322d692313baf0ef517de0ace082f846 Mon Sep 17 00:00:00 2001 From: dadaloop82 Date: Tue, 17 Mar 2026 14:18:25 +0000 Subject: [PATCH] 20260317e: Persist recipe ingredient used state to DB --- assets/js/app.js | 3 +++ index.html | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index b728150..d251211 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -4986,6 +4986,7 @@ async function loadRecipeArchive() { function viewArchivedRecipe(idx) { const entry = _recipeArchiveEntries[idx]; if (!entry) return; + _cachedRecipe = { meal: entry.meal, recipe: entry.recipe }; renderRecipe(entry.recipe); document.getElementById('recipe-overlay').style.display = 'flex'; document.getElementById('recipe-ask').style.display = 'none'; @@ -5262,6 +5263,8 @@ async function submitRecipeUse(useAll) { if (_cachedRecipe && _cachedRecipe.recipe && _cachedRecipe.recipe.ingredients && _cachedRecipe.recipe.ingredients[idx]) { _cachedRecipe.recipe.ingredients[idx].used = true; + // Persist used state to DB + saveRecipeToArchive(_cachedRecipe.recipe); } showToast('📦 Ingrediente scalato dalla dispensa!', 'success'); diff --git a/index.html b/index.html index 862941e..1f92e30 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ Dispensa Manager - + @@ -911,6 +911,6 @@ - +