indentation

This commit is contained in:
Simon Martín 2018-07-30 17:31:42 +02:00
parent 42b79e5bc6
commit 1e70717554

View File

@ -9,7 +9,7 @@ function MapConfigOverviewsAdapter(overviewsMetadataBackend, filterStatsBackend)
module.exports = MapConfigOverviewsAdapter;
MapConfigOverviewsAdapter.prototype.getMapConfig = function(user, requestMapConfig, params, context, callback) {
MapConfigOverviewsAdapter.prototype.getMapConfig = function (user, requestMapConfig, params, context, callback) {
var self = this;
var layers = requestMapConfig.layers;
@ -22,10 +22,10 @@ MapConfigOverviewsAdapter.prototype.getMapConfig = function(user, requestMapConf
var augmentLayersQueue = queue(layers.length);
function augmentLayer(layer, done) {
if ( layer.type !== 'mapnik' && layer.type !== 'cartodb' ) {
if (layer.type !== 'mapnik' && layer.type !== 'cartodb') {
return done(null, layer);
}
self.overviewsMetadataBackend.getOverviewsMetadata(user, layer.options.sql, function(err, metadata){
self.overviewsMetadataBackend.getOverviewsMetadata(user, layer.options.sql, function (err, metadata) {
if (err) {
done(err, layer);
} else {
@ -33,14 +33,14 @@ MapConfigOverviewsAdapter.prototype.getMapConfig = function(user, requestMapConf
step(
function collectFiltersData() {
var filters, unfiltered_query;
if ( layer.options.source && analysesResults && !layer.options.sql_wrap) {
if (layer.options.source && analysesResults && !layer.options.sql_wrap) {
var sourceId = layer.options.source.id;
var node = _.find(analysesResults, function(a){ return a.rootNode.params.id === sourceId; });
if ( node ) {
var node = _.find(analysesResults, function (a) { return a.rootNode.params.id === sourceId; });
if (node) {
node = node.rootNode;
filters = node.getFilters();
var filters_disabler = Object.keys(filters).reduce(
function(disabler, filter_id){ disabler[filter_id] = false; return disabler; },
function (disabler, filter_id) { disabler[filter_id] = false; return disabler; },
{}
);
unfiltered_query = node.getQuery(filters_disabler);
@ -52,12 +52,12 @@ MapConfigOverviewsAdapter.prototype.getMapConfig = function(user, requestMapConf
},
function collectStatsData(err, filters, unfiltered_query) {
var next_step = this;
if ( filters ) {
if (filters) {
self.filterStatsBackend.getFilterStats(
user,
unfiltered_query, filters,
function(err, stats) {
if ( !err ) {
function (err, stats) {
if (!err) {
query_rewrite_data.filter_stats = stats;
}
return next_step(err);
@ -68,7 +68,7 @@ MapConfigOverviewsAdapter.prototype.getMapConfig = function(user, requestMapConf
}
},
function addDataToLayer(err) {
if ( !err && !_.isEmpty(metadata) ) {
if (!err && !_.isEmpty(metadata)) {
layer = _.extend({}, layer);
layer.options = _.extend({}, layer.options, { query_rewrite_data: query_rewrite_data });
}
@ -93,7 +93,7 @@ MapConfigOverviewsAdapter.prototype.getMapConfig = function(user, requestMapConf
return callback(null, requestMapConfig);
}
layers.forEach(function(layer) {
layers.forEach(function (layer) {
augmentLayersQueue.defer(augmentLayer, layer);
});
augmentLayersQueue.awaitAll(layersAugmentQueueFinish);