From 5d413ac1f98d806f754d3f0a7d4d264551496b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Tue, 5 Sep 2017 11:26:38 +0200 Subject: [PATCH] Use template string for overrideBasicsQueryTpl --- lib/cartodb/models/dataview/histogram.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/cartodb/models/dataview/histogram.js b/lib/cartodb/models/dataview/histogram.js index ca1b9151..b00b1e1a 100644 --- a/lib/cartodb/models/dataview/histogram.js +++ b/lib/cartodb/models/dataview/histogram.js @@ -77,14 +77,14 @@ const basicsQueryTpl = ctx => ` ) `; -var overrideBasicsQueryTpl = dot.template([ - '__cdb_basics AS (', - ' SELECT', - ' max({{=it._end}}) AS __cdb_max_val, min({{=it._start}}) AS __cdb_min_val,', - ' avg({{=it._column}}) AS __cdb_avg_val, count(1) AS __cdb_total_rows', - ' FROM __cdb_filtered_source', - ')' -].join('\n')); +const overrideBasicsQueryTpl = ctx => ` + __cdb_basics AS ( + SELECT + max(${ctx._end}) AS __cdb_max_val, min(${ctx._start}) AS __cdb_min_val, + avg(${ctx._column}) AS __cdb_avg_val, count(1) AS __cdb_total_rows + FROM __cdb_filtered_source + ) +`; var iqrQueryTpl = dot.template([ '__cdb_iqrange AS (',