You have just joined the checkout team, and the stock service in stockroom/ is yours now. Nobody who wrote it is around. Read README.md and the code first: the reports below assume you know which file does what.
You have just joined the checkout team, and the stock service in stockroom/ is yours now. Nobody who wrote it is around. Read README.md and the code first: the reports below assume you know which file does what.
Work through the three phases. Every check is graded on its own, so each fix counts even if you do not finish.
Report: A cart reserved the last scarf at 12:00:00 and never paid. At 12:15:00 exactly, available still says 0.
t holds nothing from t + 900 on.Report: One lamp on hand. Two carts reserved it a few seconds apart, and both got a reservation id.
reserve refuses when fewer units are available than asked for, counting what other carts hold.Report: Six cups on hand, a cart reserves two and confirms. available says 2, not 4. Confirming the same reservation again also succeeds.
False.Add low_stock(threshold, now) to Stockroom: every SKU ever received with fewer than threshold units available at now, A to Z. Build it on the service's existing pieces.
low_stock returns the SKUs as described.Report: On sale days the stock service crawls: by evening each reservation takes longer than the last, though only a few hundred carts are open at a time. Find out why and fix it without changing what any method returns.
pytest tests/visible. Three tests fail on the current code; not every report has a failing test.Visible test command
pytest tests/visibleThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
code-comprehension-stock-service-debug-extend-optimise
Changes under src/ are evaluated.