Fix missing parameter

This commit is contained in:
Daniel García Aubert 2017-09-14 16:47:05 +02:00
parent 38e2c040d1
commit 1f3b0beddf

View File

@ -205,7 +205,7 @@ module.exports = class Aggregation extends BaseDataview {
this._isFloatColumn = null; this._isFloatColumn = null;
} }
_checkOptions () { _checkOptions (options) {
if (typeof options.column !== 'string') { if (typeof options.column !== 'string') {
throw new Error(`Aggregation expects 'column' in dataview options`); throw new Error(`Aggregation expects 'column' in dataview options`);
} }
@ -294,7 +294,8 @@ module.exports = class Aggregation extends BaseDataview {
const self = this; const self = this;
const escapedUserQuery = psql.escapeLiteral(`%${userQuery}%`); const escapedUserQuery = psql.escapeLiteral(`%${userQuery}%`);
const value = this.aggregation !== 'count' && this.aggregationColumn ? const value = this.aggregation !== 'count' && this.aggregationColumn ?
this.aggregation + '(' + this.aggregationColumn + ')' : 'count(1)'; `${this.aggregation}(${this.aggregationColumn})` :
'count(1)';
// TODO unfiltered will be wrong as filters are already applied at this point // TODO unfiltered will be wrong as filters are already applied at this point
const query = searchQueryTpl({ const query = searchQueryTpl({