fix: make order search case-insensitive
instr() in SQLite compares bytes, so searching for a customer name in uppercase (e.g. "JOHN") silently missed lowercase-stored matches like "John". Lowercase both sides of the order number, name, and email comparisons so search matches regardless of the case staff paste in. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e493d1592b
commit
a5bbc24ecf
@@ -39,9 +39,9 @@ export async function listOrderSummaries(context: DatabaseContext, query?: strin
|
|||||||
|
|
||||||
const filters = search
|
const filters = search
|
||||||
? or(
|
? or(
|
||||||
sql`instr(${orders.orderNumber}, ${search}) > 0`,
|
sql`instr(lower(${orders.orderNumber}), lower(${search})) > 0`,
|
||||||
sql`instr(${users.name}, ${search}) > 0`,
|
sql`instr(lower(${users.name}), lower(${search})) > 0`,
|
||||||
sql`instr(${users.email}, ${search}) > 0`
|
sql`instr(lower(${users.email}), lower(${search})) > 0`
|
||||||
)
|
)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user