Removing 'self' vars using arrow functions

This commit is contained in:
Simon 2017-09-18 11:34:18 +02:00
parent 51907b9545
commit f63fab40ed

View File

@ -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
}