early return

This commit is contained in:
Simon Martín 2018-07-31 15:07:34 +02:00
parent 384f4f74e0
commit 515e482886

View File

@ -32,21 +32,20 @@ FilterStatsBackends.prototype.getFilterStats = function (username, unfiltered_qu
stats.unfiltered_rows = rows;
if ( filters && !_.isEmpty(filters)) {
var analysisFilter = new AnalysisFilter(filters);
var query = analysisFilter.sql(unfiltered_query);
getEstimatedRows(this.pgQueryRunner, username, query, (err, rows) => {
if (err){
return callback(err);
}
stats.filtered_rows = rows;
return callback(null, stats);
});
} else {
if (!filters || _.isEmpty(filters)) {
return callback(null, stats);
}
var analysisFilter = new AnalysisFilter(filters);
var query = analysisFilter.sql(unfiltered_query);
getEstimatedRows(this.pgQueryRunner, username, query, (err, rows) => {
if (err){
return callback(err);
}
stats.filtered_rows = rows;
return callback(null, stats);
});
});
};