Browse Source

feat: formula - odd function logic correction

pull/7019/head
Pranav C 1 year ago
parent
commit
5fbe2c61e3
  1. 2
      packages/nocodb/src/db/functionMappings/commonFns.ts

2
packages/nocodb/src/db/functionMappings/commonFns.ts

@ -131,7 +131,7 @@ export default {
const query = (await args.fn(args.pt.arguments[0])).builder;
return {
builder: args.knex.raw(
`CASE WHEN ${query} >= 0 THEN CEIL(${query} / 2.0) * 2 + 1 \n ELSE FLOOR(${query} / 2.0) * 2 - 1\n END${args.colAlias}`,
`CASE WHEN ${query} >= 0 THEN CEIL((${query} - 1) / 2.0) * 2 + 1 \n ELSE FLOOR((${query} + 1) / 2.0) * 2 - 1\n END${args.colAlias}`,
),
};
},

Loading…
Cancel
Save