From 2772fc62d2971b9ab23bea3a0c66acba08a27ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 8 Jun 2017 18:38:44 +0200 Subject: [PATCH] Use a set/dict for checking the existence --- lib/cartodb/backends/dataview.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/cartodb/backends/dataview.js b/lib/cartodb/backends/dataview.js index 8e991b30..55fe81a0 100644 --- a/lib/cartodb/backends/dataview.js +++ b/lib/cartodb/backends/dataview.js @@ -20,7 +20,15 @@ function DataviewBackend(analysisBackend) { this.analysisBackend = analysisBackend; } -var DATE_AGGREGATIONS = ['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']; +var DATE_AGGREGATIONS = { + 'minute': true, + 'hour': true, + 'day': true, + 'week': true, + 'month': true, + 'quarter': true, + 'year': true +}; module.exports = DataviewBackend; @@ -108,7 +116,7 @@ function getOverrideParams(params, ownFilter) { {ownFilter: ownFilter} ); - if (params.aggregation && DATE_AGGREGATIONS.indexOf(params.aggregation) !== -1) { + if (params.aggregation && DATE_AGGREGATIONS.hasOwnProperty(params.aggregation)) { overrideParams.aggregation = params.aggregation; }