Increases maximum samples per order to 200#1160
Conversation
Updates frontend UI messaging, client-side validation, backend model validation, and associated tests to reflect the new limit of 200 samples per work order.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughIncrease the order quantity cap from 100 to 200: add exported ORDER_QUANTITY_MAX, update Quantity component and OrderForm validations/UI, change backend OrderSaveModel Range to 1–200, update styling class, and add/update frontend and backend tests for the new limit. ChangesOrder Quantity Limit Increase
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Anlab.Mvc/ClientApp/src/components/specs/Quantity.test.tsx (1)
53-72: ⚡ Quick winUse
ORDER_QUANTITY_MAXin test assertions to avoid drift.These tests hard-code
200in multiple places. Importing the shared constant keeps tests aligned if the limit changes again.Proposed test refactor
-import { Quantity } from "../Quantity"; +import { ORDER_QUANTITY_MAX, Quantity } from "../Quantity"; ... - it("should allow 200 samples", async () => { + it(`should allow ${ORDER_QUANTITY_MAX} samples`, async () => { ... - await user.type(screen.getByRole("textbox"), "200"); + await user.type(screen.getByRole("textbox"), String(ORDER_QUANTITY_MAX)); ... - screen.queryByText("Must be a number less than or equal to 200.") + screen.queryByText( + `Must be a number less than or equal to ${ORDER_QUANTITY_MAX}.` + ) ... - it("should reject more than 200 samples", async () => { + it(`should reject more than ${ORDER_QUANTITY_MAX} samples`, async () => { ... - await user.type(screen.getByRole("textbox"), "201"); + await user.type(screen.getByRole("textbox"), String(ORDER_QUANTITY_MAX + 1)); ... - screen.getByText("Must be a number less than or equal to 200.") + screen.getByText( + `Must be a number less than or equal to ${ORDER_QUANTITY_MAX}.` + )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Anlab.Mvc/ClientApp/src/components/specs/Quantity.test.tsx` around lines 53 - 72, Import the shared ORDER_QUANTITY_MAX constant into Quantity.test.tsx and replace the hard-coded 200/201 usages: use ORDER_QUANTITY_MAX when calling user.type in the "should allow" test and use ORDER_QUANTITY_MAX + 1 in the "should reject" test; also build the expected error string with a template using ORDER_QUANTITY_MAX (e.g. `Must be a number less than or equal to ${ORDER_QUANTITY_MAX}.`) so the assertions against screen.getByText/screen.queryByText remain correct; keep references to QuantityHarness and the existing test names unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Anlab.Mvc/ClientApp/src/components/specs/Quantity.test.tsx`:
- Around line 53-72: Import the shared ORDER_QUANTITY_MAX constant into
Quantity.test.tsx and replace the hard-coded 200/201 usages: use
ORDER_QUANTITY_MAX when calling user.type in the "should allow" test and use
ORDER_QUANTITY_MAX + 1 in the "should reject" test; also build the expected
error string with a template using ORDER_QUANTITY_MAX (e.g. `Must be a number
less than or equal to ${ORDER_QUANTITY_MAX}.`) so the assertions against
screen.getByText/screen.queryByText remain correct; keep references to
QuantityHarness and the existing test names unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 90865f88-b3aa-45f8-a1d2-70b116303626
📒 Files selected for processing (6)
Anlab.Mvc/ClientApp/src/components/OrderForm.tsxAnlab.Mvc/ClientApp/src/components/Quantity.tsxAnlab.Mvc/ClientApp/src/components/specs/Quantity.test.tsxAnlab.Mvc/Models/Order/OrderSaveModel.csTest/TestsController/OrderControllerTests.csTest/TestsModel/OrderSaveModelTests.cs
Ensures test assertions and validation messages directly reference the maximum quantity constant for improved maintainability and consistency.
Establishes a dedicated visual style for displaying validation and error messages, supporting the implementation of new quantity limits.
| color: $unitrans-red; | ||
| } | ||
|
|
||
| .text-error { |
There was a problem hiding this comment.
This is new, error message wasn't red. Maybe a hold over from the bootstrap update.
|
Hold for them to be able to work with this on their side. |
Updates frontend UI messaging, client-side validation, backend model validation, and associated tests to reflect the new limit of 200 samples per work order.
Close Issue #1150
Summary by CodeRabbit
New Features
Bug Fixes
UI/Text
Tests
Style