Track partial consumption / sub-unit inventory for multi-pack items #12

Open
opened 2026-04-02 21:54:31 -07:00 by pyr0ball · 0 comments
Owner

Problem

When a product is scanned as a multi-pack (e.g. a 4-stick pack of butter, a 6-pack of yoghurt), the inventory item has quantity=1 and unit=pack. There is no way to track that 1 of 4 sticks has been used.

Desired Behaviour

  • Scan flow: Auto-detect pack size from product data (Open Food Facts serving_size / unit_count) and pre-fill quantity accordingly (e.g. quantity=4, unit=stick)
  • Recipe use: When a recipe is cooked, offer to decrement specific ingredient quantities from inventory rather than marking entire items as consumed
  • Partial consume endpoint: POST /inventory/items/{id}/consume should accept an optional quantity param (default: consume all)

Acceptance Criteria

  • scanBarcodeText / scanBarcodeImage pre-fills sub-unit quantity when product data includes it
  • POST /inventory/items/{id}/consume?quantity=1 decrements by that amount; only marks status=consumed when quantity reaches 0
  • UI shows remaining quantity on inventory cards
  • Recipe suggestion view offers "Mark ingredients as used" which decrements each matched pantry item by a reasonable serving amount

Notes

  • inventory_items.quantity and inventory_items.unit already exist in the schema
  • Serving-size data quality from Open Food Facts is variable — fall back to quantity=1 when not available
## Problem When a product is scanned as a multi-pack (e.g. a 4-stick pack of butter, a 6-pack of yoghurt), the inventory item has `quantity=1` and `unit=pack`. There is no way to track that 1 of 4 sticks has been used. ## Desired Behaviour - **Scan flow:** Auto-detect pack size from product data (Open Food Facts serving_size / unit_count) and pre-fill quantity accordingly (e.g. quantity=4, unit=stick) - **Recipe use:** When a recipe is cooked, offer to decrement specific ingredient quantities from inventory rather than marking entire items as consumed - **Partial consume endpoint:** `POST /inventory/items/{id}/consume` should accept an optional `quantity` param (default: consume all) ## Acceptance Criteria - [ ] `scanBarcodeText` / `scanBarcodeImage` pre-fills sub-unit quantity when product data includes it - [ ] `POST /inventory/items/{id}/consume?quantity=1` decrements by that amount; only marks `status=consumed` when quantity reaches 0 - [ ] UI shows remaining quantity on inventory cards - [ ] Recipe suggestion view offers "Mark ingredients as used" which decrements each matched pantry item by a reasonable serving amount ## Notes - `inventory_items.quantity` and `inventory_items.unit` already exist in the schema - Serving-size data quality from Open Food Facts is variable — fall back to quantity=1 when not available
pyr0ball added this to the Beta — Recipe Suggestions milestone 2026-04-04 16:33:19 -07:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/kiwi#12
No description provided.