Add Restocking tab with budget-driven recommendations#37
Open
pauly-ant wants to merge 2 commits intobeck-source:mainfrom
Open
Add Restocking tab with budget-driven recommendations#37pauly-ant wants to merge 2 commits intobeck-source:mainfrom
pauly-ant wants to merge 2 commits intobeck-source:mainfrom
Conversation
- Backend: GET /api/restocking/recommendations (greedy budget fill by trend priority), POST /api/restocking/orders (lead time = slowest item), GET /api/restocking/orders - Restocking.vue: budget slider, live recommendation table, totals, Place Order button with success banner - Orders.vue: new Submitted Restocking Orders section (conditional) showing lead time and expected delivery - 14 backend tests; full suite 54/54 passing
- ARCHITECTURE.md: system overview, tech stack, data flow, filter pipeline - CLAUDE.md: note to document non-obvious logic changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A new Restocking tab where users set a budget via slider and get demand-forecast-driven restock recommendations that fit within it. Placing an order surfaces it in the Orders tab with a computed delivery lead time.
How it works
Recommendation algorithm (server/main.py): greedy budget fill. Items are scored by trend_weight * 1000 + demand_growth (increasing=3, stable=2, decreasing=1), sorted descending, then added until budget is exhausted. Unit costs come from inventory.json where available, with a fallback table for demand SKUs that don't exist there (8 of 9).
Lead time: the slowest item sets the pace for the whole shipment. Increasing-trend items ship in 7 days, stable in 14, decreasing in 21, so a mixed order gets max() of its items' lead times.
UI flow: drag slider, recommendations table live-updates, click Place Order, success banner shows order number + lead time, switch to Orders tab, new "Submitted Restocking Orders" section appears above All Orders.
Files
Tests
14/14 passed in test_restocking.py, 54/54 in full backend suite. Adversarial checks (zero/negative budget, invalid trend, idempotency, 5-way concurrent POSTs) all handled correctly.