Move function to class as private method
This commit is contained in:
parent
593a72a967
commit
63e4bcebef
@ -18,16 +18,7 @@ MapConfigOverviewsAdapter.prototype.getMapConfig = function (user, requestMapCon
|
||||
|
||||
var augmentLayersQueue = queue(layers.length);
|
||||
|
||||
layers.forEach(function (layer) {
|
||||
augmentLayersQueue.defer(
|
||||
augmentLayer,
|
||||
this.overviewsMetadataBackend,
|
||||
this.filterStatsBackend,
|
||||
user,
|
||||
layer,
|
||||
analysesResults
|
||||
);
|
||||
});
|
||||
layers.forEach(layer => augmentLayersQueue.defer(this._augmentLayer.bind(this), user, layer, analysesResults));
|
||||
|
||||
augmentLayersQueue.awaitAll(function layersAugmentQueueFinish (err, layers) {
|
||||
if (err) {
|
||||
@ -44,12 +35,12 @@ MapConfigOverviewsAdapter.prototype.getMapConfig = function (user, requestMapCon
|
||||
});
|
||||
};
|
||||
|
||||
function augmentLayer(overviewsMetadataBackend, filterStatsBackend, user, layer, analysesResults, callback) {
|
||||
MapConfigOverviewsAdapter.prototype._augmentLayer = function (user, layer, analysesResults, callback) {
|
||||
if (layer.type !== 'mapnik' && layer.type !== 'cartodb') {
|
||||
return callback(null, layer);
|
||||
}
|
||||
|
||||
overviewsMetadataBackend.getOverviewsMetadata(user, layer.options.sql, function (err, metadata) {
|
||||
this.overviewsMetadataBackend.getOverviewsMetadata(user, layer.options.sql, (err, metadata) => {
|
||||
if (err) {
|
||||
return callback(err, layer);
|
||||
}
|
||||
@ -70,7 +61,7 @@ function augmentLayer(overviewsMetadataBackend, filterStatsBackend, user, layer,
|
||||
|
||||
var unfilteredQuery = getUnfilteredQuery(analysesResults, layer);
|
||||
|
||||
filterStatsBackend.getFilterStats(user, unfilteredQuery, filters, function (err, stats) {
|
||||
this.filterStatsBackend.getFilterStats(user, unfilteredQuery, filters, function (err, stats) {
|
||||
if (err) {
|
||||
return callback(null, layer);
|
||||
}
|
||||
@ -83,7 +74,7 @@ function augmentLayer(overviewsMetadataBackend, filterStatsBackend, user, layer,
|
||||
return callback(null, layer);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function getRootNode (analysesResults, sourceId) {
|
||||
var node = _.find(analysesResults, function (a) {
|
||||
|
Loading…
Reference in New Issue
Block a user