fix(nests): use partial matching for customer filter in SearchParts
The customer parameter on the parts search endpoint was doing exact equality matching against CustomerName/CustID, so partial values like "sull" would never match "Sullys". Changed to case-insensitive Contains matching, consistent with how the search term is handled. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -216,7 +216,12 @@ public class NestsController : ControllerBase
|
|||||||
nestsQuery = nestsQuery.Where(n => n.DateProgrammed!.Value.Year == year.Value);
|
nestsQuery = nestsQuery.Where(n => n.DateProgrammed!.Value.Year == year.Value);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(customer))
|
if (!string.IsNullOrWhiteSpace(customer))
|
||||||
nestsQuery = nestsQuery.Where(n => n.CustomerName == customer || n.CustID == customer);
|
{
|
||||||
|
var customerUpper = customer.Trim().ToUpper();
|
||||||
|
nestsQuery = nestsQuery.Where(n =>
|
||||||
|
(n.CustomerName != null && n.CustomerName.ToUpper().Contains(customerUpper)) ||
|
||||||
|
(n.CustID != null && n.CustID.ToUpper().Contains(customerUpper)));
|
||||||
|
}
|
||||||
|
|
||||||
var nests = await nestsQuery
|
var nests = await nestsQuery
|
||||||
.Select(n => new
|
.Select(n => new
|
||||||
|
|||||||
Reference in New Issue
Block a user