diff --git a/lib/cartodb/backends/cluster.js b/lib/cartodb/backends/cluster.js index 650b42ce..c90f176d 100644 --- a/lib/cartodb/backends/cluster.js +++ b/lib/cartodb/backends/cluster.js @@ -6,6 +6,7 @@ const debug = require('debug')('backend:cluster'); const AggregationMapConfig = require('../models/aggregation/aggregation-mapconfig'); module.exports = class ClusterBackend { + // jshint maxcomplexity: 17 getClusterFeatures (mapConfigProvider, params, callback) { mapConfigProvider.getMapConfig((err, _mapConfig) => { if (err) { @@ -91,9 +92,7 @@ module.exports = class ClusterBackend { return callback(error); } - for (const [columnName, exp] of Object.entries(expressions)) { - const { aggregate_function, aggregated_column } = exp; - + for (const { aggregate_function, aggregated_column } of Object.values(expressions)) { if (typeof aggregated_column !== 'string') { const error = new Error(`Invalid aggregation input, aggregated column should be an string`); error.http_status = 400; @@ -108,7 +107,9 @@ module.exports = class ClusterBackend { } if (typeof aggregate_function !== 'string') { - const error = new Error(`Invalid aggregation input, aggregate function should be an string`); + const error = new Error( + `Invalid aggregation input, aggregate function should be an string` + ); error.http_status = 400; error.type = 'layer'; error.subtype = 'aggregation'; diff --git a/test/acceptance/cluster.js b/test/acceptance/cluster.js index 87ff63f5..a535f6c3 100644 --- a/test/acceptance/cluster.js +++ b/test/acceptance/cluster.js @@ -567,7 +567,7 @@ describe('cluster', function () { }); }); - describe.only('invalid aggregation', function () { + describe('invalid aggregation', function () { const expectedColumnsError = { errors:[ 'Invalid aggregation input, columns should be and array of column names' ], errors_with_context:[