Skip to content

Commit 15868ae

Browse files
author
Lars-Erik Roald
committed
count fix on aggregate
1 parent 353318d commit 15868ae

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/hostExpress/executePath.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,16 @@ function _executePath(context, ...rest) {
120120
return json;
121121

122122
function tryGetAnyAllNone(path, table) {
123-
path = path.split('.');
124-
for (let i = 0; i < path.length; i++) {
125-
table = table[path[i]];
123+
const parts = path.split('.');
124+
for (let i = 0; i < parts.length; i++) {
125+
table = table[parts[i]];
126126
}
127127

128-
let ops = new Set(['all', 'any', 'none', 'count', 'where', '_aggregate']);
128+
let ops = new Set(['all', 'any', 'none', 'where', '_aggregate']);
129129
// let ops = new Set(['all', 'any', 'none', 'where']);
130-
let last = path.slice(-1)[0];
130+
let last = parts[parts.length - 1];
131+
if (last === 'count' && parts.length > 1)
132+
ops.add('count');
131133
if (ops.has(last) || (table && (table._primaryColumns || (table.any && table.all))))
132134
return table;
133135
}

0 commit comments

Comments
 (0)