💄 shorten long lines

This commit is contained in:
Javier Goizueta 2016-05-17 15:46:13 +02:00
parent 7f7204df6c
commit 42ef40282b
2 changed files with 15 additions and 12 deletions

View File

@ -50,12 +50,16 @@ MapConfigOverviewsAdapter.prototype.getLayers = function(username, layers, analy
function collectStatsData(err, filters, unfiltered_query) {
var next_step = this;
if ( filters ) {
self.filterStatsApi.getFilterStats(username, unfiltered_query, filters, function(err, stats) {
if ( !err ) {
query_rewrite_data.filter_stats = stats;
self.filterStatsApi.getFilterStats(
username,
unfiltered_query, filters,
function(err, stats) {
if ( !err ) {
query_rewrite_data.filter_stats = stats;
}
return next_step(err);
}
return next_step(err);
});
);
} else {
return next_step(null);
}

View File

@ -291,13 +291,12 @@ function overviews_query(query, overviews, zoom_level, zoom_level_expression) {
function should_use_overviews(query, data) {
data = data || {};
var use_overviews = data.overviews && is_supported_query(query);
if ( use_overviews ) {
if ( data.filters && data.filter_stats ) {
var filtered_rows = data.filter_stats.filtered_rows;
var unfiltered_rows = data.filter_stats.unfiltered_rows;
if ( unfiltered_rows && (filtered_rows || filtered_rows === 0) ) {
use_overviews = filtered_rows >= FILTER_MIN_ROWS || (filtered_rows/unfiltered_rows) > FILTER_MAX_FRACTION;
}
if ( use_overviews && data.filters && data.filter_stats ) {
var filtered_rows = data.filter_stats.filtered_rows;
var unfiltered_rows = data.filter_stats.unfiltered_rows;
if ( unfiltered_rows && (filtered_rows || filtered_rows === 0) ) {
use_overviews = filtered_rows >= FILTER_MIN_ROWS ||
(filtered_rows/unfiltered_rows) > FILTER_MAX_FRACTION;
}
}
return use_overviews;