diff --git a/lib/cartodb/models/dataview/aggregation.js b/lib/cartodb/models/dataview/aggregation.js index 7f6c198a..b4c59af2 100644 --- a/lib/cartodb/models/dataview/aggregation.js +++ b/lib/cartodb/models/dataview/aggregation.js @@ -229,8 +229,6 @@ module.exports = class Aggregation extends BaseDataview { } sql (psql, override, callback) { - const self = this; - if (!callback) { callback = override; override = {}; @@ -238,11 +236,11 @@ module.exports = class Aggregation extends BaseDataview { if (this._shouldCheckColumnType()) { this._isFloatColumn = false; - this.getColumnType(psql, this.aggregationColumn, this.queries.no_filters, function (err, type) { + this.getColumnType(psql, this.aggregationColumn, this.queries.no_filters, (err, type) => { if (!err && !!type) { - self._isFloatColumn = type.float; + this._isFloatColumn = type.float; } - self.sql(psql, override, callback); + this.sql(psql, override, callback); }); return null; } @@ -295,7 +293,6 @@ module.exports = class Aggregation extends BaseDataview { } search (psql, userQuery, callback) { - const self = this; const escapedUserQuery = psql.escapeLiteral(`%${userQuery}%`); const value = this.aggregation !== 'count' && this.aggregationColumn ? `${this.aggregation}(${this.aggregationColumn})` : @@ -319,12 +316,12 @@ module.exports = class Aggregation extends BaseDataview { debug(query); - psql.query(query, function(err, result) { + psql.query(query, (err, result) => { if (err) { return callback(err, result); } - return callback(null, {type: self.getType(), categories: result.rows }); + return callback(null, {type: this.getType(), categories: result.rows }); }, true); // use read-only transaction }