From 1f3b0beddfa5120d56a7337a0fd5c3de23a1f3f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 14 Sep 2017 16:47:05 +0200 Subject: [PATCH] Fix missing parameter --- lib/cartodb/models/dataview/aggregation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cartodb/models/dataview/aggregation.js b/lib/cartodb/models/dataview/aggregation.js index 29eebe06..f621e536 100644 --- a/lib/cartodb/models/dataview/aggregation.js +++ b/lib/cartodb/models/dataview/aggregation.js @@ -205,7 +205,7 @@ module.exports = class Aggregation extends BaseDataview { this._isFloatColumn = null; } - _checkOptions () { + _checkOptions (options) { if (typeof options.column !== 'string') { throw new Error(`Aggregation expects 'column' in dataview options`); } @@ -294,7 +294,8 @@ module.exports = class Aggregation extends BaseDataview { const self = this; const escapedUserQuery = psql.escapeLiteral(`%${userQuery}%`); 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 const query = searchQueryTpl({