Browse Source

fix(nocodb): AVG function handler return value correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5392/head
Pranav C 2 years ago
parent
commit
5670f51019
  1. 12
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/commonFns.ts

12
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/commonFns.ts

@ -91,10 +91,9 @@ export default {
),
};
},
AVG: (args: MapFnArgs) => {
AVG: async (args: MapFnArgs) => {
if (args.pt.arguments.length > 1) {
return {
builder: args.fn(
return args.fn(
{
type: 'BinaryExpression',
operator: '/',
@ -103,12 +102,9 @@ export default {
},
args.a,
args.prevBinaryOp
),
};
);
} else {
return {
builder: args.fn(args.pt.arguments[0], args.a, args.prevBinaryOp),
};
return args.fn(args.pt.arguments[0], args.a, args.prevBinaryOp);
}
},
FLOAT: async (args: MapFnArgs) => {

Loading…
Cancel
Save