wrolpi/modules/inventory
Roland ee0b827c71
Add a recommended Food Storage example, a Ration tab, and a supply planner
Build on the rebuilt config-only Inventory with three related additions.

Recommended example inventory:
- A fresh install now seeds the "Food Storage" example with the recommended
  one-adult / one-year (~3,000 kcal/day) emergency food supply (60 items,
  ~1.12M kcal), instead of an empty inventory.
- The counts are layered on top of the shipped food catalog (single source of
  per-package nutrition) via RECOMMENDED_ONE_YEAR_FOOD_COUNTS, joined at seed
  time by recommended_food_storage_items().
- Genericized the two remaining brand names in the catalog defaults
  (Velveeta -> Processed Cheese, Spam -> Canned Lunch Meat) so both the catalog
  and the seeded inventory stay brand-free.

Ration tab (split out of Summary):
- Moved the Ration Estimate (People / Daily Calories / estimate table) out of
  the increasingly long Summary tab into its own "Ration" tab, shown only for
  inventories that have a calories field.

Supply planner ("Plan More Supply"):
- A slider picks a target duration longer than the current estimate; the whole
  inventory is scaled up proportionally (every item by the same factor, mix
  kept balanced) into a sortable shopping list of what to buy.
- Any split package rounds UP to a whole one (ceil), matching the "1.6 buckets
  -> buy 1 more" rule.
- The shopping list is exportable as CSV (reusing toCSV) and PDF (reusing the
  print-to-PDF path, scoped via body.printing-shopping so only the list prints
  -- no inventory or summary).

Search filter:
- Moved the items search out of the top toolbar (which implied it filtered
  every tab) into the Items tab, so it clearly narrows Items only;
  Summary/Ration/Export/print always use the full inventory.

Aggregation/role helpers (findNameKey, planSupplyPurchase) live in summarize.js,
the single source of truth shared by Summary, export, and the ration views.
All new pure functions and UI flows are covered by tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 12:40:30 -06:00
..
test Add a recommended Food Storage example, a Ration tab, and a supply planner 2026-06-19 12:40:30 -06:00
__init__.py Rebuild Inventory as a config-only system with food catalog and calculators 2026-06-14 17:14:54 -06:00
api.py Rebuild Inventory as a config-only system with food catalog and calculators 2026-06-14 17:14:54 -06:00
catalog.py Rebuild Inventory as a config-only system with food catalog and calculators 2026-06-14 17:14:54 -06:00
catalog_defaults.yaml Add a recommended Food Storage example, a Ration tab, and a supply planner 2026-06-19 12:40:30 -06:00
common.py Add a recommended Food Storage example, a Ration tab, and a supply planner 2026-06-19 12:40:30 -06:00
conftest.py Rebuild Inventory as a config-only system with food catalog and calculators 2026-06-14 17:14:54 -06:00
defaults.py Add a recommended Food Storage example, a Ration tab, and a supply planner 2026-06-19 12:40:30 -06:00
errors.py Rebuild Inventory as a config-only system with food catalog and calculators 2026-06-14 17:14:54 -06:00
migrate.py Rebuild Inventory as a config-only system with food catalog and calculators 2026-06-14 17:14:54 -06:00
schema.py Rebuild Inventory as a config-only system with food catalog and calculators 2026-06-14 17:14:54 -06:00