Browse Source

fix: ROUNDUP and ROUNDDOWN precision

pull/7268/head
Pranav C 11 months ago
parent
commit
bc72aa6e6a
  1. 4
      packages/nocodb/src/db/functionMappings/commonFns.ts
  2. 4
      packages/nocodb/src/db/functionMappings/pg.ts

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

@ -303,7 +303,7 @@ export default {
return {
builder: knex.raw(
`ROUND(FLOOR((${valueBuilder}) * POWER(10, ${precisionBuilder})) / POWER(10, ${precisionBuilder}))${colAlias}`,
`(FLOOR((${valueBuilder}) * POWER(10, ${precisionBuilder})) / POWER(10, ${precisionBuilder}))${colAlias}`,
),
};
},
@ -317,7 +317,7 @@ export default {
return {
builder: knex.raw(
`ROUND(CEIL((${valueBuilder}) * POWER(10, ${precisionBuilder})) / POWER(10, ${precisionBuilder}))${colAlias}`,
`(CEIL((${valueBuilder}) * POWER(10, ${precisionBuilder})) / POWER(10, ${precisionBuilder}))${colAlias}`,
),
};
},

4
packages/nocodb/src/db/functionMappings/pg.ts

@ -360,7 +360,7 @@ END ${colAlias}`,
return {
builder: knex.raw(
`ROUND((FLOOR((${valueBuilder}) * POWER(10, ${precisionBuilder})) / POWER(10, ${precisionBuilder})::numeric(30,${precisionBuilder})))${colAlias}`,
`(FLOOR((${valueBuilder}) * POWER(10, ${precisionBuilder})) / POWER(10, ${precisionBuilder})::numeric(30,${precisionBuilder}))${colAlias}`,
),
};
},
@ -374,7 +374,7 @@ END ${colAlias}`,
return {
builder: knex.raw(
`ROUND((CEIL((${valueBuilder}) * POWER(10, ${precisionBuilder})) / POWER(10, ${precisionBuilder}))::numeric(30,${precisionBuilder}))${colAlias}`,
`(CEIL((${valueBuilder}) * POWER(10, ${precisionBuilder})) / POWER(10, ${precisionBuilder})::numeric(30,${precisionBuilder}))${colAlias}`,
),
};
},

Loading…
Cancel
Save