Use sql as replacement variable

This commit is contained in:
Raul Ochoa 2016-05-06 17:09:41 +02:00
parent 7d4caf6974
commit 3e94e3288f
2 changed files with 2 additions and 2 deletions

View File

@ -142,7 +142,7 @@ AnalysisMapConfigAdapter.prototype.getMapConfig = function(analysisConfiguration
var analysisSql = layerQuery(layerNode.getQuery(), layerNode.getColumns()); var analysisSql = layerQuery(layerNode.getQuery(), layerNode.getColumns());
var sqlQueryWrap = layer.options.sql_wrap; var sqlQueryWrap = layer.options.sql_wrap;
if (sqlQueryWrap) { if (sqlQueryWrap) {
analysisSql = sqlQueryWrap.replace(/<%=\s*__analysis_query\s*%>/g, analysisSql); analysisSql = sqlQueryWrap.replace(/<%=\s*sql\s*%>/g, analysisSql);
} }
layer.options.sql = analysisSql; layer.options.sql = analysisSql;
var layerDataviews = getLayerDataviews(layer, dataviews); var layerDataviews = getLayerDataviews(layer, dataviews);

View File

@ -337,7 +337,7 @@ describe('analysis-layers', function() {
"source": { "source": {
"id": "2570e105-7b37-40d2-bdf4-1af889598745" "id": "2570e105-7b37-40d2-bdf4-1af889598745"
}, },
"sql_wrap": "SELECT * FROM (<%= __analysis_query %>) __wrapped WHERE adm0cap = 1", "sql_wrap": "SELECT * FROM (<%= sql %>) __wrapped WHERE adm0cap = 1",
"cartocss": DEFAULT_MULTITYPE_STYLE, "cartocss": DEFAULT_MULTITYPE_STYLE,
"cartocss_version": "2.3.0" "cartocss_version": "2.3.0"
} }