From 78d32ea817ea03464be7c146f20798b69f57cbb2 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 21 Dec 2023 09:17:03 +0000 Subject: [PATCH] fix: ODD formula correction --- packages/nocodb/src/db/functionMappings/commonFns.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nocodb/src/db/functionMappings/commonFns.ts b/packages/nocodb/src/db/functionMappings/commonFns.ts index ef3f8b5db3..8db49675cf 100644 --- a/packages/nocodb/src/db/functionMappings/commonFns.ts +++ b/packages/nocodb/src/db/functionMappings/commonFns.ts @@ -226,7 +226,7 @@ export default { const query = (await args.fn(args.pt.arguments[0])).builder; return { builder: args.knex.raw( - `CASE WHEN ${query} % 2 = 0 THEN CEIL(${query})\nELSE CEIL(${query} / 2.0) * 2\n END${args.colAlias}`, + `CASE WHEN ${query} >= 0 THEN CEIL((${query}) / 2.0) * 2 \n ELSE FLOOR((${query} + 2) / 2.0) * 2 - 2\n END${args.colAlias}`, ), }; },