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

Loading…
Cancel
Save