Repository navigation
Fix the search and vehicle routes - #35
Merged
Merged
Conversation
Drops the isCool request parameter from SearchController, the System.out.println it triggered, and the "Cool Checkbox" in the search form that sent it. [Ticket: #16] Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
custId is a primitive long bound to an optional request parameter, so Spring cannot represent its absence and a bare GET /search fails with IllegalStateException before the handler runs. [Ticket: #16] Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bind custId as a Long and check it for null before comparing, and give the optional String parameters a default of "" so the isEmpty() checks do not throw when a parameter is absent. A bare GET /search now renders the results page with no matches. [Ticket: #16] Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- AdminController: remove GET /admin/create_employee, which rendered a missing employee_form template. Nothing links to it; the HR administrator page posts its employee form directly to POST /admin/create_employee, which is unchanged. - VehicleController: GET /vehicles/search works for a non-blank VIN; only its blank-VIN branch rendered a missing add_new_vehicle template. A blank search now redirects to the vehicle list. (The repair orders page's VIN search form targets this route with POST, which it does not accept; that is a separate, unchanged defect.) Every view name returned by a controller now has a template. [Ticket: #17] Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The shared vin-search fragment submits with POST, but GET /vehicles/search is the only mapping, so the VIN search on the repair orders page returns 405. The second test covers the blank-VIN redirect added earlier in this branch. [Ticket: #17] Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The vin-search fragment is shared with the customer page, where the same form posts to a route that creates a record, and its ADD NEW button reuses the form to post elsewhere. Switching the fragment to GET would break that, so the search route accepts both methods. [Ticket: #17] Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Five earlier versions of loops that the live code beside them replaced. [Ticket: #16] Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #16
Fixes the broken routes in the search and vehicle paths, test-first in both cases.
GET /searchreturned 500custIdwas a primitivelongbound to an optional request parameter, so Spring could not represent its absence and the request failed before the handler ran. It is now aLong, checked for null before use, and the optionalStringparameters default to""so theisEmpty()checks hold when a parameter is absent. A bareGET /searchrenders the results page with no matches.Also removes the
isCoolrequest parameter, theSystem.out.printlnit triggered, and the "Cool Checkbox" in the search form that sent it, plus five commented-out earlier versions of loops that sit beside the live code.Two routes pointed at templates that no longer exist
GET /admin/create_employeerenderedemployee_form. Nothing links to it, and the HR administrator page posts its employee form directly toPOST /admin/create_employee, which is unchanged, so the GET route is removed.GET /vehicles/searchrenderedadd_new_vehiclewhen the VIN was blank. A blank search now redirects to the vehicle list.Every view name returned by a controller now has a template.
The VIN search returned 405
The shared
vin-searchfragment submits with POST, but onlyGET /vehicles/searchwas mapped, so the VIN search on the repair orders page failed. The fragment is also used by the customer page, where the same form posts to a route that creates a record, and its "ADD NEW" button reuses the form to post elsewhere — switching the fragment to GET would break both. The search route accepts either method instead.Tests
GET /searchwith no parameters rendersresultsIllegalStateException→ 500POST /vehicles/searchwith a VIN renders the vehicle list/vehiclesNot fixed here
Searching by first and last name with vehicle results still throws
ConcurrentModificationException: the list it iterates is the same list it adds to. It is recorded as a known defect in the README rather than fixed, to keep this change small.🤖 Generated with Claude Code