This commit is contained in:
Daniel García Aubert
2019-03-01 17:05:35 +01:00
parent f9e5d9d0a9
commit dcf147cdfb
2 changed files with 6 additions and 5 deletions

View File

@@ -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';

View File

@@ -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:[