From 5d6eaf32ea9d84dd2121f0f428bac3af7a7c0e62 Mon Sep 17 00:00:00 2001 From: Etienne Donneger Date: Fri, 16 Aug 2024 16:08:35 +0000 Subject: [PATCH] Allow for case-insensitive `symcode` query parameter (#61) --- src/usage.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/usage.ts b/src/usage.ts index 1cd3047..e60f022 100644 --- a/src/usage.ts +++ b/src/usage.ts @@ -21,7 +21,10 @@ export async function makeUsageQuery(ctx: Context, endpoint: UsageEndpoints, use // Don't add `limit` and `block_range` to WHERE clause for (const k of Object.keys(query_params).filter(k => k !== "limit" && k !== "block_range" && k !== "chain")) { const clickhouse_type = typeof query_params[k as keyof typeof query_params] === "number" ? "int" : "String"; - filters += ` (${k} = {${k}: ${clickhouse_type}}) AND`; + if (k === 'symcode') // Special case to allow case-insensitive symcode input + filters += ` (${k} = upper({${k}: ${clickhouse_type}})) AND`; + else + filters += ` (${k} = {${k}: ${clickhouse_type}}) AND`; } filters = filters.substring(0, filters.lastIndexOf(' ')); // Remove last item ` AND`