From 51907b95459b653af790f7c137d5edc9bf867906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 14 Sep 2017 16:56:55 +0200 Subject: [PATCH] Apply extract method to condition --- lib/cartodb/models/dataview/aggregation.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cartodb/models/dataview/aggregation.js b/lib/cartodb/models/dataview/aggregation.js index f621e536..7f6c198a 100644 --- a/lib/cartodb/models/dataview/aggregation.js +++ b/lib/cartodb/models/dataview/aggregation.js @@ -236,7 +236,7 @@ module.exports = class Aggregation extends BaseDataview { override = {}; } - if (this.aggregationColumn && this._isFloatColumn === null) { + if (this._shouldCheckColumnType()) { this._isFloatColumn = false; this.getColumnType(psql, this.aggregationColumn, this.queries.no_filters, function (err, type) { if (!err && !!type) { @@ -266,6 +266,10 @@ module.exports = class Aggregation extends BaseDataview { return callback(null, aggregationSql); } + _shouldCheckColumnType () { + return this.aggregationColumn && this._isFloatColumn === null; + } + format (result) { const { count = 0,