Skip to content

Increases maximum samples per order to 200#1160

Open
jSylvestre wants to merge 7 commits into
masterfrom
JCS/IncreaseMaxSamples
Open

Increases maximum samples per order to 200#1160
jSylvestre wants to merge 7 commits into
masterfrom
JCS/IncreaseMaxSamples

Conversation

@jSylvestre

@jSylvestre jSylvestre commented May 6, 2026

Copy link
Copy Markdown
Member

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

    • Maximum order quantity increased to 200; UI help text and inputs updated.
  • Bug Fixes

    • Quantity validation and focus/handling corrected so ≤200 are accepted and >200 show proper errors.
  • UI/Text

    • "Client Provided Id" field label wording updated.
  • Tests

    • Added unit and UI tests validating the 200-limit behavior and related error messages.
  • Style

    • Error text styling unified/updated.

Review Change Stack

Updates frontend UI messaging, client-side validation, backend model validation, and associated tests to reflect the new limit of 200 samples per work order.
@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@jSylvestre has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 42 minutes and 10 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea1ede9f-4680-4083-9df8-f69d8a107025

📥 Commits

Reviewing files that changed from the base of the PR and between 0ea75e9 and ab054b0.

📒 Files selected for processing (1)
  • Anlab.Mvc/AnlabMvc.csproj
📝 Walkthrough

Walkthrough

Increase 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.

Changes

Order Quantity Limit Increase

Layer / File(s) Summary
Data Shape / Constants
Anlab.Mvc/ClientApp/src/components/Quantity.tsx, Anlab.Mvc/Models/Order/OrderSaveModel.cs
Add exported ORDER_QUANTITY_MAX = 200 and update backend OrderSaveModel.Quantity Range attribute upper bound to 200. IQuantityProps updated (removed quantityRef).
Quantity component & Frontend Tests
Anlab.Mvc/ClientApp/src/components/Quantity.tsx, Anlab.Mvc/ClientApp/src/components/specs/Quantity.test.tsx
Use ORDER_QUANTITY_MAX as the IntegerInput max and wire value, onChange, min, max, and inputRef. Add QuantityHarness and tests verifying required attribute, acceptance of 200, and rejection of >200.
OrderForm wiring / Validation
Anlab.Mvc/ClientApp/src/components/OrderForm.tsx
Import ORDER_QUANTITY_MAX; replace hard-coded 100 in help text, _validate check, and _handleErrors focus logic. Update the “Client Provided Id” label text.
Styling
Anlab.Mvc/ClientApp/src/css/components.scss
Replace .red-text with .text-error and apply the same red color in the new class.
Backend / Controller Tests
Test/TestsController/OrderControllerTests.cs, Test/TestsModel/OrderSaveModelTests.cs
Update controller tests to use quantity 200, add helpers CreateValidOrderSaveModel(int) and ValidateModelIntoModelState(...), and add OrderSaveModelTests verifying 200 is valid and 201 is rejected.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ucdavis/Anlab#1167: Edits to the same OrderForm client-provided-id label and related UI field.

Poem

🐰 Two hundred carrots, neatly in a row,
Constants hop in place, validations grow.
Frontend hums, backend nods in tune,
Tests clap softly under a springtime moon.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Increases maximum samples per order to 200' directly and clearly describes the main change: updating the quantity limit from 100 to 200 across frontend and backend components.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch JCS/IncreaseMaxSamples

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Anlab.Mvc/ClientApp/src/components/specs/Quantity.test.tsx (1)

53-72: ⚡ Quick win

Use ORDER_QUANTITY_MAX in test assertions to avoid drift.

These tests hard-code 200 in 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

📥 Commits

Reviewing files that changed from the base of the PR and between 39ca59b and e9cb040.

📒 Files selected for processing (6)
  • Anlab.Mvc/ClientApp/src/components/OrderForm.tsx
  • Anlab.Mvc/ClientApp/src/components/Quantity.tsx
  • Anlab.Mvc/ClientApp/src/components/specs/Quantity.test.tsx
  • Anlab.Mvc/Models/Order/OrderSaveModel.cs
  • Test/TestsController/OrderControllerTests.cs
  • Test/TestsModel/OrderSaveModelTests.cs

jSylvestre added 2 commits May 6, 2026 12:21
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 {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new, error message wasn't red. Maybe a hold over from the bootstrap update.

@jSylvestre

Copy link
Copy Markdown
Member Author

Hold for them to be able to work with this on their side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants