Support sql_wrap for aggregation
This commit is contained in:
parent
e8740af6ef
commit
98e8d745b1
@ -93,10 +93,11 @@ module.exports = class AggregationMapConfigAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shouldAdapt) {
|
if (shouldAdapt) {
|
||||||
const aggregation = new Aggregation(mapConfig, layer.options.sql, layer.options.aggregation);
|
const sql = layer.options.sql_raw ? layer.options.sql_raw : layer.options.sql;
|
||||||
|
const aggregation = new Aggregation(mapConfig, sql, layer.options.aggregation);
|
||||||
const sqlQueryWrap = layer.options.sql_wrap;
|
const sqlQueryWrap = layer.options.sql_wrap;
|
||||||
|
|
||||||
let aggregationSql = aggregation.sql(layer.options);
|
let aggregationSql = aggregation.sql();
|
||||||
|
|
||||||
if (sqlQueryWrap) {
|
if (sqlQueryWrap) {
|
||||||
layer.options.sql_raw = aggregationSql;
|
layer.options.sql_raw = aggregationSql;
|
||||||
|
@ -482,6 +482,32 @@ describe('aggregation', function () {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('when sql_wrap is provided should return a tile', function (done) {
|
||||||
|
this.mapConfig = createVectorMapConfig([
|
||||||
|
{
|
||||||
|
type: 'cartodb',
|
||||||
|
options: {
|
||||||
|
sql_wrap: SQL_WRAP,
|
||||||
|
sql: POINTS_SQL_1,
|
||||||
|
aggregation: {
|
||||||
|
threshold: 1
|
||||||
|
},
|
||||||
|
cartocss: '#layer { marker-width: 1; }',
|
||||||
|
cartocss_version: '2.3.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
this.testClient = new TestClient(this.mapConfig);
|
||||||
|
|
||||||
|
this.testClient.getTile(0, 0, 0, {}, (err) => {
|
||||||
|
if (err) {
|
||||||
|
return done(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user