Phase 1: mobile-first pantry redesign with In/Low/Out state
Track presence (In/Low/Out) as the primary signal instead of exact quantities; quantity becomes an optional integer, unit optional too (migration 0003 backfills state from quantity: 0 -> out, else in). - Pantry rebuilt as a phone-first card list: colored state rail, segmented In/Low/Out switch (server-driven HTMX), greyed out-items, live summary counts. - Fast add: bottom add bar with type-ahead autocomplete, location picker, and quick-add chips for things you've run out of. - Per-item menu (move / set expiry / delete); expiry is now an optional quiet pill, never required. - New endpoints: pantry search + set-state; dropped the old edit-expiry/cancel flow and its partial. - Recipes matcher made presence-based (have-it beats have-enough); state added to admin. Tests cover state, add/restock, search, presence matching, and page rendering. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
25a09b08fc
commit
ce61a0a86f
@@ -94,14 +94,15 @@ class Command(BaseCommand):
|
||||
# --- Pantry Items (from current Pantry.md as of 31 Mar 2026) ---
|
||||
self.stdout.write("Creating pantry items...")
|
||||
|
||||
def add_pantry(name, qty, unit, location, expiry=None, is_staple=False, notes=""):
|
||||
def add_pantry(name, qty, unit, location, expiry=None, is_staple=False, notes="", state="in"):
|
||||
# Use ingredient + location for lookup so same ingredient can exist
|
||||
# in multiple locations (e.g. sausages in fridge AND freezer)
|
||||
PantryItem.objects.get_or_create(
|
||||
ingredient=ingredients[name],
|
||||
location=location,
|
||||
defaults={
|
||||
"quantity": Decimal(str(qty)),
|
||||
"state": state,
|
||||
"quantity": int(qty),
|
||||
"unit": unit,
|
||||
"expiry_date": expiry,
|
||||
"is_staple": is_staple,
|
||||
@@ -132,7 +133,7 @@ class Command(BaseCommand):
|
||||
add_pantry(name, 1, "n/a", "cupboard", is_staple=True)
|
||||
|
||||
# Out of stock (for reference)
|
||||
add_pantry("eggs", 0, "items", "fridge", notes="OUT — restock")
|
||||
add_pantry("eggs", 0, "items", "fridge", notes="OUT — restock", state="out")
|
||||
add_pantry("baked beans", 1, "tins", "cupboard")
|
||||
add_pantry("freezer bags", 1, "boxes", "cupboard")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user